How to call matlab function from VS2010

754 Views Asked by At

I need in my program to load an image data like what matlab does when it loads images and store it in a matrix, and then I will do some operations on this matrix and view it after that. so I need some help, how can i use matlab functions with loading images and displaying them from visual studio 2010

Thanks a lot

2

There are 2 best solutions below

0
On

Similar to the answer I posed here, there are two ways to call Matlab inside visual-studio:

  1. Distribute MATLAB into independent shared library: check out my blog-post on how to do this (with detail steps and example).

  2. Call MATLAB Engine directly: Refer to another blog of mine for more info.

0
On

i tink this link is useful http://internetexception.com/post/2013/01/20/Using-with-Matlab-from-C-sharp-application.aspx

write this code inside any c# function

        var activationContext = Type.GetTypeFromProgID("matlab.application.single");
               var matlab =(MLApp.MLApp)Activator.CreateInstance(activationContext);
            matlab.Execute("cd 'C:\\Program Files\\MATLAB';");
            matlab.PutWorkspaceData("y", "base", simArray);
then any code you used in matlab can written in 
matlab.Execute("");