using deployment tool I produced the c++ shared library. My Matlab Function just get one input parameter which is the path of images, and return a 1*6 vector in double;
I searched a lot on net and found the steps the calling Matlab functions in C++; Now I know that at first I must initialize the application and the library such as these:
#include <libname.h>
mclInitializeApplication();
mclInitializeApplication();
and I know that at last I must call functions for terminate:
<libname>Terminate();
mclTerminateApplication();
but I dont know how can I pass a string to the matlab function. I write so:
string path = "C:\\Users\\user\\Documents\\MATLAB\\Mypic.jpg";
mwArray im_path;
In calling im_path.SetData()
I do not know which type I must use. the types of first parameter, does not include any type related to string.
Also I do not know how to call the Matlab function and which parameters I must pass to that.
please help me if you do that call before.
thank you so much!
To pass a
string
as the input parameter to Matlab, you can simply use:And you also need to initialize the function first and terminate it afterwards. Suppose your function are like
function res = func(path)
and being deployed tofunc.lib
, you need:Check out this post for more info.