Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Integrating C#/Matlab !! ?? Errors !
Replies: 1   Last Post: Aug 7, 2013 4:26 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Animesh Pandey

Posts: 63
Registered: 12/22/10
Integrating C#/Matlab !! ?? Errors !
Posted: Jul 13, 2011 8:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I used the Matlab help to integrate Matlab functions in C#. I was successful in making an assembly for the m-file given below !

% Reading the wav-file ....
% 'a' is a string that represents the path of the *.wav file
function read_aud(a)
[y f] = wavread(a);

t = 0:1/f:(length(y)-1)/f;
plot(t, y), grid on;

n = length(y)-1;
t1 = 0:f/n:f;
fou = abs(fft(y));
figure, plot(t1,fou), grid on;
This is the main C# code !

using System;
using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;
using readAud;

[assembly: NativeGC(true, GCBlockSize = 25)] // Set native memory management block size to 25 MB.

namespace readAud
/// <summary>
/// This application demonstrates plotting a .wav file in
/// time-domain and its FFT also !
/// </summary>
class readAud
#region MAIN

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
string url = @"\\test.wav";

// Create a new signalAndFft object
signalAndFft plotter = new signalAndFft();

// Casting a string to an MWCharArray which is to be passes as an argument in read_aud.m

Console.ReadLine(); // Wait for user to exit application

catch (Exception exception)
Console.WriteLine("Error: {0}", exception);


The exception that I got was :
Could not load type 'readAud.signalAndFft' from assembly 'readAud, Version=, Culture=neutral, PublicKeyToken=null'.

What could be the reason ??

The project can be downloaded from

Please help !

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.