Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Ads

Discussion Groups

Discussion Groups | Matlab DSP | Urgent problem about Mex function

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Urgent problem about Mex function - andey - May 10 10:28:00 2003



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. nrhs=100 does it avoid
this crash?

Thanks in advance

Andey





(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )