MATLAB生成c代码和exe文件


1安装mcc

mbuild -setup

Please choose your compiler for building standalone MATLAB applications:

Would you like mbuild to locate installed compilers [y]/n? y

Select a compiler:

[1] Lcc-win32 C 2.4.1 in D:\PROGRA~1\MATLAB\R2009bb\sys\lcc

[0] None

Compiler: 1

Please verify your choices:

Compiler: Lcc-win32 C 2.4.1

Location: D:\PROGRA~1\MATLAB\R2009bb\sys\lcc

Are these correct [y]/n? y

Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2009b\compopts.bat

From template:              D:\PROGRA~1\MATLAB\R2009bb\bin\win32\mbuildopts\lcccompp.bat

Done . . .

2..安装mex

mex -setup

Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? y

Select a compiler:

[1] Lcc-win32 C 2.4.1 in D:\PROGRA~1\MATLAB\R2009bb\sys\lcc

[0] None

Compiler: 1

Please verify your choices:

Compiler: Lcc-win32 C 2.4.1

Location: D:\PROGRA~1\MATLAB\R2009bb\sys\lcc

Are these correct [y]/n? y

Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2009b\mexopts.bat

From template:              D:\PROGRA~1\MATLAB\R2009bb\bin\win32\mexopts\lccopts.bat

Done . . .

**************************************************************************

Warning: The MATLAB C and Fortran API has changed to support MATLAB

           variables with more than 2^32-1 elements. In the near future

           you will be required to update your code to utilize the new

           API. You can find more information about this at:

           http://www.mathworks.com/support/solutions/data/1-5C27B9.html?solution=1-5C27B9

           Building with the -largeArrayDims option enables the new API.

**************************************************************************

转化成exe c代码

mcc -B sgl example6_3_3.m


之后的文件为

MATLAB生成c代码和exe文件_第1张图片
注意有的人在初次使用时可能会碰到很多问题

网上都解决方案的。

特别注意了:文件应该放在英文目录下操作如 放在 d:\try 文件夹中。就不会出问题。

你可能感兴趣的:(MATLAB生成c代码和exe文件)