【Matlab】C转matlab——MEX库
1.安装库
matlab命令行输入上述指令安装MEX库
2.新建cpp文件并在matlab里打开
将全部的c代码复制过去
3.将C中主函数main()修改
将main() 函数替换为mexFunction()函数
/*__________调用mex文件__________________*/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
/*nlhs:输出参数数目 (Left-hand side)
plhs:指向输出参数的指针
nrhs:输入参数数目
examle: [a,b]=test(c,d,e)
调用mex函数test时,传给test的这三个参数分别是 prhs[0]=c ,prhs[1]=d ,prhs[2]=e
*/
{
int i,bLsbFirst,nRead,nRecords=0;
char *sFile=NULL;
int argc=0;
//in=mxGetPr(plhs[0]);//