06.08.2013 Views

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

mxSetClassName(P,"p");<br />

memcpy((char *)mxGetPr(P),(char *)poly,4*sizeof(double));<br />

engPutVariable(ep,P);<br />

engOutputBuffer(ep,buffer,300);<br />

engEvalString(ep,"disp(['多项式',poly2str(p,'x'),' 的根']),r=roots(p)");<br />

MessageBox(NULL,buffer,"exm12032_1 展示 MATLAB 引擎的应用",MB_OK);<br />

engClose(ep);<br />

mxDestroyArray(P);<br />

return EXIT_SUCCESS;<br />

(2)<br />

cd d:\mywork<br />

mex -f D:\MATLAB6p5\bin\win32\mexopts\msvc60engmatopts.bat exm12032_1.c<br />

(3)<br />

图 12.3-1<br />

【例 12.3.2-2】MATLAB 引擎综合应用实例。本例演示:(A)MATLAB 引擎对用户自编<br />

M 函数文件的调用;(B)借用 DOS 界面作为 MATLAB 的指令输入和结果发布窗。<br />

(1)<br />

#include <br />

#include <br />

#include <br />

#include "engine.h"<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!