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

Discussion Groups

Discussion Groups | Matlab DSP | Does Matlab Mex file completely support C++ class?

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

  

Post a new Thread

Does Matlab Mex file completely support C++ class? - andey - Apr 4 8:47:00 2003



I tested a simple C++ Mex file which is:

#include <iostream.h>
#include <fstream.h>

void timestwo(double y[], double x[])
{

ofstream File;

File.open("test.str",ios::out);
File << " TEST is OK " << endl;
File.close();

y[0] = 2.0*x[0];

}

void mexFunction(...)
{
......
}

The *.dll crashed when I ran it ( although it was compiled
successfully ). There is error "Segmentation violation".
But the strange thing is that the file "test.str" was created.
I wonder if Mex file completely support all C++ class. I replaced
above codes with C, which is:

#include <stdio.h>

void timestwo(double y[], double x[])
{

FILE *fp;
fp = fopen("test.str","w");
fprintf(fp,"%d\n",x[0]);
fclose(fp);

y[0] = 2.0*x[0];

}

void mexFunction(...)
{
......
}

I ran and compiled above Mex C file. Everything is fine.

andey




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