#include "mex.h" #include "matrix.h" void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int i, m; double data1, data2; double *data3; if (nrhs != nlhs) mexErrMsgTxt("The number of input and output arguments must be the same."); /*for (i = 0; i < nrhs; i++) /*{ /* Find the dimensions of the data */ m = mxGetM(prhs[0]); /*n = mxGetN(prhs[0]); /* Create an mxArray for the output data */ data3 = mxCreateDoubleMatrix(m, 1, mxREAL); /* Put data in the output array */ for (i = 0; i < m-1; i++) { /* Retrieve the input data */ data1 = (double)*mxGetPr(prhs[i]); data2 = (double)*mxGetPr(prhs[i+1]); /* Create a pointer to the output data */ // data3 = mxGetPr(plhs[i]); if (data1 <=.45 & data2>.45){ data3[i]=1.0; }else{ data3[i]=0.0; } } /*}*/ }