00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "mex.h"
00017
00018 void
00019 mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
00020 {
00021 int status;
00022 mxArray *error_msg[1];
00023 char *buf;
00024
00025 (void) plhs;
00026
00027
00028 if (nrhs !=1 || !mxIsDouble(prhs[0]) ||
00029 mxGetN(prhs[0])*mxGetM(prhs[0]) != 1 || mxIsComplex(prhs[0])) {
00030 mexErrMsgTxt("Input argument must be a real scalar double.");
00031 }
00032
00033 if(nlhs > 1){
00034 mexErrMsgTxt("Too many output arguments.");
00035 }
00036
00037
00038 mexSetTrapFlag((int)mxGetScalar(prhs[0]));
00039
00040
00041 status = mexCallMATLAB(0, (mxArray **)NULL,
00042 0, (mxArray **)NULL, "nofcn");
00043
00044
00045
00046
00047 if(status==0){
00048 mexPrintf("???? nofcn exists ????\n");
00049 }
00050 else{
00051
00052
00053
00054
00055 mexCallMATLAB(1,error_msg,0, (mxArray **)NULL, "lasterr");
00056 buf = mxArrayToString(error_msg[0]);
00057 mexPrintf("The last error message issued in MATLAB was: \n%s\n", buf);
00058 mxFree(buf);
00059 mexErrMsgTxt("mexCallMATLAB failed.\n");
00060 }
00061 }
00062
00063
00064
00065
00066
00067
00068