You can see an article about how to build .net assembly on MATLAB. Here we involve two matlab types, MWArray and MWNumericArray.


  • matlab ne project name : projname
  • class name : classname
  • function name : func,with an argument : 2D matrix and output also is 2D matrix
  • input array : 2D array in C#, name is myarray
using projname;

classname myclass = new classname();

MWArray results = myclass.func((MWNumericArray)myarray);

double[,] resultArr = (double[,])results.ToArray();

Hope those can help you all.

By the way, you can use "arrname(:)" to convert n-D matrix to n by 1 matrix in matlab