⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exm120153_2.cpp

📁 这是学习matlab的好的程序
💻 CPP
字号:
#include "mex.h"		//
#define MAX 1000

//-------------------------------------------------
void fill( double *pr, int *pm, int *pn, int max )
{
	int i;
	*pm = max/2;
	*pn = 1;
	for (i=0; i < (*pm); i++)
		pr[i]=i*(4*3.14159/max);
}

//-------------------------------------------------
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
	int m, n, max=MAX;
	mxArray *rhs[1], *lhs[1];
	
	rhs[0] = mxCreateDoubleMatrix(max, 1, mxREAL);		//
	
	fill(mxGetPr(rhs[0]), &m, &n, MAX);						//
	
	mxSetM(rhs[0], m);								//
	mxSetN(rhs[0], n);								//
	
	mexCallMATLAB(1, lhs, 1, rhs, "mexzzy");	//
	mexCallMATLAB(0, NULL, 1, lhs, "plot");	//

	mxDestroyArray(rhs[0]);							//
	mxDestroyArray(lhs[0]);							//

	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -