Reply by andey May 10, 20032003-05-10
Dear All:

I am trying to call Mex function under Matlab. I used the mexFunction
without arguments, i.e. nlhs = 0 and nrhs=0. All my data are read or
written inside C++ program. But when I try to read a large number of
ascii data for example, an array of 100. The mex function always
crash. The following is my codes:

void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[])
{
/* Check for proper number of arguments. */
if ((nlhs!=0)||(nrhs!=0))
mexPrintf("no input output required");

evaluate();
} void evaluate(void)
{
........
// Read the data from the file
inFile.open("truss.fit",ios::in);
if ( inFile.fail())
cout << " Can not open"; for (j= 0; j < 100; j++)
{

inFile >> fitnessValue[j];
}

inFile.close();

......
}

I doubt if mex function can deal with a large number of data I/O. If I
transfer the data through mex arguments, i.e. nrhs0 does it avoid
this crash?

Thanks in advance

Andey