?? randomnum.c
字號(hào):
/*MEX function example,create random numbers——randomnum.c*/
#include "mex.h"
/*MEX function entrance*/
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
double *m,*n,*flag;
/*error detecting*/
if(nlhs>1||nrhs!=3)
mexErrMsgTxt("error:wrong numbers of input/output!");
m=mxGetPr(prhs[0]);
n=mxGetPr(prhs[1]);
flag=mxGetPr(prhs[2]);
plhs[0]=mxCreateDoubleMatrix(*m,*n,mxREAL);
/*set output flag*/
mexSetTrapFlag(*flag);
/*wrong transfer-->function rnd does not exsit*/
mexCallMATLAB(1,plhs,2,prhs,"rnd");
/*continue to run MEX function file so rand function is transfered by MEX file*/
mexPrintf("user set Flag to 1.\n");
/*rright transfer*/
mexCallMATLAB(1,plhs,2,prhs,"rand");
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -