#include "mex.h"
/*下面这个mexFunction的目的是使MATLAB知道如何调用这个函数*/
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
double m,*p;
int M,N;
int i,j;
if(nrhs!=1)
mexErrMsgTxt("One input required.");
m=mxGetScalar(prhs[0]);
mexPrintf("hello,world!%lf\n",m);
p=mxGetPr(prhs[0]);
mexPrintf("hello,world!%lf\n",*p);
M=mxGetM(prhs[0]);
N=mxGetN(prhs[0]);
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
mexPrintf("%4.3lf ",p[j*M+i]);
mexPrintf("\n");
}
}
mexPrintf("%4.3lf ",p[j*M+i])
最新推荐文章于 2021-05-20 10:14:25 发布