The code which executed prompts to error is:
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
double p;
p = (double)mxGetScalar(prhs[0]);
mexCallMATLAB(0,NULL,1, prhs, "clear");
}
Where I am trying to clear a variable which is in workspace pointed by prhs[0].
Please suggest what am I doing wrong.
Error message when executed this function with one argument. gives following error message:
callmatlabtest(10)
??? Error using ==> clear
Argument must contain a string.
I believe you need to have
&prhs[0]in your call:I’ve tested this code and it works (in a file named mextest.c):
and here is the result: