📄 showmatrix.c
字号:
/* showmatrix.c文件内容提要*/
#include "mex.h"
#include "matrix.h"
void mexFunction(int nlhs,mxArray * plhs90,int nrhs,const mxArray * prhs[])
{
int i,j,k;
mwIndex index;
double* pr=UNLL;
double* pr=UNLL;
size_t M,N;
size_t ndim;
mwSize dims[2];
for(i=0,i<nrhs;i++)
{
if((mxIsDouble(prhs[i])) && (mxGetNumberOfDimensions(prhs[i]==2))
{
pr=mxGetPr(prhs[i]);
pi=mxGetPi(prhs[i]);
M=mxGetM(prhs[i]);
N=mxGetN(prhs[i]);
ndim=mxGetNumberOfDimensions(prhs[i]);
mexPrintf("变量%d:\n",i);
for(j=0;j<M;j++)
{
dims[0]=j;
for(k=0,k<n;k++)
{
dims[1]=k;
index=mxCalcSingleSubscript(prhs[i],ndim,dims);
if(pi==NULL)
{
mexPrintf("%6.2f,",pr[index]);
}
else
{
mexPrintf("%6.2f+%6.2fj,",pr[index],pi[index]);
}
}
mexPrintf("\n");
}
}
else
{
mexPrintf("输入%d个变量不是二维double数值阵列!\n",i);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -