📄 mex_cell.c
字号:
#include "matrix.h"
/*Function mex_cell*/
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
mxArray *xp;
int i, j, m, n;
if (nrhs!=1) mexErrMsgTxt("Wrong number of input arguments!");
if (nlhs>1) mexErrMsgTxt("Too many output arguments!");
m=mxGetM(prhs[0]); n=mxGetN(prhs[0]);
plhs[0]=mxCreateCellMatrix(n,m);
for (i=0; i<m; i++) {
for (j=0; j<n; j++) {
xp=mxGetCell(prhs[0],j*m+i);
mxSetCell(plhs[0], i*n+j, xp);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -