这里仅讲述matlab调用C的混合编程,暂不涉及C调用matlab的混合编程。
mtalab第一次调用C编程之前,需运行mex操作,此操作在windows系统下是一个bat的批处理文件,在unix系统下是个shell脚本。
>> mex-setup //在matlab 的command window下运行此命令
Please choose yourcompiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n?y //是否调用本地安装好的c编译软件
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2010b\sys\lcc
[2] Microsoft Visual C++ 6.0 in C:\Program Files\Microsoft VisualStudio
[0] None
Compiler: 1 //也可以选择2
Please verify your choices:
Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~1\MATLAB\R2010b\sys\lcc
Are these correct [y]/n? y //确认正确
Trying to update options file:C:\Users\XJT\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat
Fromtemplate: C:\PROGRA~1\MATLAB\R2010b\bin\win32\mexopts\lccopts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API haschanged to support MATLAB
variables with more than 2^32-1 elements. In thenear 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/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************