14-2 ?????用程?

Aڭ̨ӻpHMATLABsĶӱN@MATLAB禡sĶWε{]Stand-alone Application^A{iHbSw MATLAB qCҨϥΪOO mccA榡pUG

mcc Vm userFunc.m

䤤 userFunc.m O@ӥѨϥΪ̩ҳ]pMATLAB禡AgMATLABsĶഫAiH userFunc.exe]Lnx^ userFunc]Unix/Linuxx^iɡAAiHbSw MATLAB LqoɮסC

ڭ̨Ӭݤ@²檺dҡCAڭ̥g@ MATLAB 禡myEigValue.mA禡JO@Ӥ}Aèϥ MATLAB ب eig ӭp⦹}TȡAMNTȦCLXӡA禡lXpUG

14-matlabsĶ/myEigValue.mfunction eigValue = myEigValue(mat) %myEigValue: Generate the eigenvalues of the given matrix % Roger Jang, 20080210 if (isstr(mat)) % YJOrAনƭ mat=eval(mat); end [a, b] = eig(mat); eigValue=diag(b); disp(eigValue); % ܩT eigenValue

զdҡAiHbMATLABROJG

myEigValue(magic(5));

Yibùܤ@ 5X5 ]N}ҹTȡC

Hint
bNMATLAB禡sĶiɪL{A|ͤ@B~ɮסAҥHANdҥѥЫܵwСA~iHUާ@C

ѩڭ̭nN myEigValue.m ഫ myEigValue.exeAҥH@DzӸ`nSOpߡG

  1. ]MATLAB禡নɫADOSҤUJƬOHr覡ǤJ]ROCѼơ^AҥH myEigValue.m ϥ eval NJrର}C
  2. myEigValue.m ϥ disp GLbùWAHK myEigValue.exe ӦLXP˪GC

ۡAڭ̦bMATLABROUANu@ؿܦ myEigValue.m ҦbؿAMϥΤUCROӱN myEigValue.m sĶ myEigValue.exeApUG

mcc Vm myEigValue.m

Hint
u-mvNϥΥ]Macro^ӲͿWε{AoO@w]ﶵC

jgLbɶAN|sĶAòͼƭɮסA]t @ӥi myEigValue.exeCYnզiɡAiHb DOS ROUJG

myEigValue.exe magic(5)

Yibùܤ@ 5X5 ]N}ҹTȡCYnJ@ӯSw}AiHϥ޸ӥ]N}rAdҦpUG

myEigValue.exe "[1 2 3; 3 2 1; 1 1 1]" ڭ̥iHNWzy{z@ӳ@dҡG

Example 1: 14-matlabsĶ/mcc01.mfprintf('MATLAB version=%s\n', version); if ~exist('myEigValue'), mkdir('myEigValue'); end fprintf('Compiling myEigValue.m...\n'); tic; mcc -m myEigValue.m -d myEigValue; fprintf('Time for compiling = %g sec\n', toc); fprintf('Running DOS command: myEigValue\\myEigValue.exe magic(5)\n'); !myEigValue\myEigValue.exe magic(5) fprintf('Running DOS command: myEigValue\\myEigValue.exe "[1 2 3; 3 2 1; 1 1 1]"\n'); !myEigValue\myEigValue.exe "[1 2 3; 3 2 1; 1 1 1]" MATLAB version=7.14.0.739 (R2012a) Compiling myEigValue.m... DEMO Compiler license. The generated application will expire 30 days from today, on Sat Sep 15 20:06:02 2012. Time for compiling = 45.2777 sec Running DOS command: myEigValue\myEigValue.exe magic(5) 65.0000 -21.2768 -13.1263 21.2768 13.1263 Running DOS command: myEigValue\myEigValue.exe "[1 2 3; 3 2 1; 1 1 1]" 5.0000 -1.0000 0.0000

bWzdҤAڭ̦hFXơAɮץؿcb@ǡG
  1. pGXؿ myEigValue sbAڭ̥إ߳oӥؿC
  2. b mcc OϥΡu-d myEigValuevHwXؿAҦXɮס]]t̫᪺iɮס^|QsbؿC

bϥ mcc ɡA٦XIn`NG

Ѧ覡ҽsĶXӪiɡAYnbSw MATLAB A٥h@DӦw MATLAB 禡wAwɪmpU]H 64-bit Windows xҡ^G

{matlabroot}\toolbox\compiler\deploy\win64\MCRInstaller.exe
wɥuݰ@YiAԲӻAiѨsĶL{Ҳͪ readme.txtAάObMATLABJumcrinstallerv]mcrNMATLAB Compiler RuntimeAΨӦs|QΨ쪺MATLAB{w^ANiHoTC
MATLAB{]pGig