目的
通过混编方式,可以将Matlab强大的算法仿真运算能力真正运用到工程实际,使得自行开发系统的技术含量得到进一步提升。混编后可以将基于Matlab开发的算法不编译成VC++程序,进而使得算法的整个运算过程在基于VC++开发的系统中独立运行,便于算法的实际调用。
混编所采用的软件
推荐使用Microsoft Visual Studio 2005、Matlab R2007a或更高版本,以便使得源文件之间得到最佳的编译效果。(如果使用VC++,但具体编译环境配置请自行斟酌。)
编译过程
启动Matlab R2007a,在command window键入:mex –setup(配置. Mexw32文件的编译环境,Matlab ,后面会有详细介绍)。
键入mex –setup回车后,Matlab显示如下:
>> mex -setup
Please choose piler for building external interface (MEX) files:
Would you like mex to locate pilers [y]/n? n
Select piler:
[1] Borland C++ Compiler (mand line tools)
[2] Borland C++Builder
[3] Borland C++Builder
[4] Compaq Visual Fortran
[5] Compaq Visual Fortran
[6] Intel C++ (with Microsoft Visual C++ 2005 linker)
[7] Intel Visual Fortran (with Microsoft Visual C++ 2005 linker)
[8] Intel Visual Fortran (with Microsoft Visual C++ 2005 linker)
[9] Intel Visual Fortran (with Microsoft Visual C++ .NET 2003 linker)
[10] Lcc-win32 C
[11] Microsoft Visual C++
[12] Microsoft Visual C++ .NET 2003
[13] Microsoft Visual C++ 2005
[14] Microsoft Visual C++ 2005 Express Edition
[15] Open C++
[0] None
Compiler: 13
Your machine has a Microsoft Visual C++ piler located at
D:\Microsoft Visual Studio 8. Do you want to use piler [y]/n? y
Please verify your choices:
Compiler: Microsoft Visual C++ 2005
Location: D:\Microsoft Visual Studio 8
Are these correct?([y]/n): y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2005 require
that Microsoft Visual Studio 2005 run-time libraries be
available on puter they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
You can find more information about this at:
port/solutions/data/1-
***********************
Matlab与VC 混编手册 来自淘豆网m.daumloan.com转载请标明出处.