- 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.