Hi, I need some suggestions on deploying a C# program that uses Matlab functions.

I wrote a C# program using Visual Studio 2005 that incorporates Matlab functions. I started out with a basic program:
MLApp.MLAppClass matlab = new MLApp.MLAppClass();
matlab.Visible = 0;
string ans = matlab.Execute("3+5");
System.Console.WriteLine(ans);
It works fine on the development computer, but when I try to deploy it to another computer I get the following error:
Retrieving the COM factory for component with CLSID {07FB7FDD-3B80-4D41-A793-326AC619EA11} failed due to the following error: 80040154.
I did run the MCRInstaller.exe (found in the original computers installation folder) on the second computer, but I still have the above error. Any help or suggestions would be much appreciated. Thanks!

 Accepted Answer

I figured it out. Basically you can't do it that way unless all computers have a full installation of Matlab. Instead you have to use Matlab's deploytool function to compile and make an application from Matlab. I ended up porting all my c# code to matlab .m scripts and compiling it as a .NET assembly using deploytool.
You can also use the MWArray class to pass variables between c# and Matlab functions. I found this full example very helpful in my development: http://www.mathworks.com/support/solutions/en/data/1-3NL1YX/index.html?solution=1-3NL1YX
Just do everything they do in that example and it should make sense. Good luck.

More Answers (0)

Categories

Find more on Application Deployment in Help Center and File Exchange

Asked:

B
B
on 29 Feb 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!