00001 #include "mex.h" 00002 #include "temptst.h" 00003 00004 extern N1<double> callsquare(N1<double> n1); 00005 00006 void mexFunction(int nlhs,mxArray *plhs[],int nrhs, const mxArray *prhs[]) 00007 { 00008 if (nrhs < 1) 00009 mexErrMsgTxt("Need at least one argument"); 00010 if (mxGetM(prhs[0]) == 0) 00011 mexErrMsgTxt("First argument must have at least one entry"); 00012 double* m = mxGetPr(prhs[0]); 00013 00014 N1<double> ans = callsquare(N1<double>(*m)); 00015 mxArray* result = mxCreateDoubleMatrix(1,1,mxREAL); 00016 *mxGetPr(result) = ans.data(); 00017 plhs[0] = result; 00018 return; 00019 } 00020 00021 00022
1.5.1