- In C# add a reference by navigating to Project->Add Reference, then select the COM tab, then select the Matlab Application... At first there was no Matlab entry. I think I fixed this by running "Matlab -regserver" from the command line. This should register Matlab as a COM server.
- Create a C# Matlab object with this code: private MLApp.MLAppClass matlab
- Execute matlab code via strings like this: matlab.Execute(string);
- Retrive data from matlab using the GetFullMatrix command, like this: matlab.GetFullMatrix("variable", "base", ref real, ref imag); where variable is the name of the variable, real is the real part of the variable, image is the imaginary part of the variable.

By the way, if you are interested in C# you should check out my colleagues blog here.

If you liked this post, please check out one of the sponsoring websites via the Google Ads.

Thanks A Lot. I guess that should work..

ReplyDeleteYou sir, Rock! Thanks a million - was looking for this solution of ages

ReplyDeleteThank you so much! I constantly had problems with the Matlab compiler because I am using Matlab x64. This worked great! I really can't thank you enough!

ReplyDeletehi sir,

ReplyDeletei don't know how to fixed this by running "Matlab -regserver" from the command line as you state in this blog???