To work around this problem, you must pass the variable name as a string argument to the MEX function. This way there would not be any need to get the variable's name in the MATLAB workspace. And the data can be copied from the MATLAB workspace using the mexGetVariable function.
Therefore, if for instance you previously called the MEX function by passing a variable:
You can modify your MEX-file so that you now pass the variable name as a string:
Then to get the data into the MEX file, you can use the mexGetVariable function:
mxArray *data = mexGetVariable("caller", mxArrayToString(prhs[0]));
Best Answer