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

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Matlab DSP | C routine...

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

  

Post a new Thread

C routine... - Michele Dicerto - Sep 26 12:53:00 2001

I have some problem with C routine.
I have compiled one simple C file,
an example of matlab's manual,
but when i call my routine matlab crash.

Below you can find the code and what matlab
reply before crash.

thanks a lot.

Michele Dicerto

#include "mex.h"

void doppio(double y[], double x[])
{
y[0]=2.*x[0];
} void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[])
{
double *x,*y;
int mrows,ncols;

if (nrhs!=1)
mexErrMsgTxt("One input required");
else if (nlhs>1)
mexErrMsgTxt("One input required");

mrows=mxGetM(prhs[0]);
ncols=mxGetN(prhs[0]);

if
(!mxIsDouble(prhs[0])||mxIsComplex(prhs[0])||!(mrows==1
&& ncols==1))
mexErrMsgTxt("Double input please");

plhs[0]=mxCreateDoubleMatrix(mrows,ncols,mxREAL);

x=mxGetPr(prhs[0]);
y=mxGetPr(plhs[0]);

doppio(x,y);

}

Segmentation violation occurred within signal handler.
Unable to complete stack trace (stack was probably
corrupted)

Please follow these steps in reporting this problem to
The MathWorks so
that we have the best chance of correcting it:

1. Send us this crash report.

2. Provide a brief description of what you were
doing when this
problem occurred.

3. If possible, include M-files, MEX-files, or
MDL-files that aid
in reproducing it.

4. E-mail or FAX this information to us at:
E-mail:
FAX: 508-647-7201

Thank you for your assistance. Please save your
workspace and restart
MATLAB before continuing your work.







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