I would like to pass a vector of strings from C++ to matlab. I have tried using the functions available such as mxCreateCharMatrixFromStrings but it doesn't give me the correct behavior.
So, I have something like this:
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
vector<string> stringVector;
stringVector.push_back("string 1");
stringVector.push_back("string 2");
//etc...
The problem is how do I get this vector to the matlab environment?
plhs[0] = ???
My goal is to be able to run:
>> [strings] = MyFunc(...)
>> strings(1) = 'string 1'