文档详情

matlab 2010b与VS2008 混合编程的实现.pdf

发布:2017-05-26约9.74千字共8页下载文档
文本预览下载声明
by luo_oul 2012.4 错误反馈与技术交流:luo_debug@ matlab 2010b 与VS2008 混合编程的实现 ——对 Contourlet 工具包的使用的一点说明 基本原理: matlab 数学与图像处理功能强大,我们可把matlab 中的功能模块经过一定的处理后, 供Visual Studio 2008 调用,其基本原理是:把matlab 中的功能模块做成一个函数,再通过 matlab 的指令,将函数做成动态链接库(.dll)文件,VS2008 便可直接调用特定的接口函数实 现调用matlab 中的功能函数。 下面由一个简单实例来说明matlab 与VS2008 混合编程的过程(以下实例是基于matlab 2010b 与VS2008 ,如果版本不同,指令可能会有所改变,但不变的是思想)。 MATLAB 中的设置 先在Matlab 里面新建一个M 文件,代码如下: function [ y ] = add( a,b ) y=a+b; end 将m 文件保存为 add.m,保存在D:\test 文件夹中。然后在Matlab 主窗口中将当前文件夹 改为D:\test,即在 command window 中键入如下代码: cd D:\test 要使Matlab 函数能成动态链接文件DLL 供VS 调用,在Matlab 中,我们需要设置一下Matlab 的编译库,在Matlab 主窗口中键入如下代码: mbuild –setup 会出现: Please choose your compiler for building standalone MATLAB applications: Would you like mbuild to locate installed compilers [y]/n? 选择: y ,键入y 后出现: Select a compiler: [1] Lcc-win32 C 2.4.1 in E:\MATLAB\R2010b\sys\lcc [2] Microsoft Visual C++ 2008 SP1 in C:\Program Files\Microsoft Visual Studio 9.0 [0] None 即提示我们选择编译器,选择2,键入 2 后,出现: Please verify your choices: by luo_oul 2012.4 错误反馈与技术交流:luo_debug@ Compiler: Microsoft Visual C++ 2008 SP1 Location: C:\Program Files\Microsoft Visual Studio 9.0 Are these correct [y]/n? 选择 y,键入 y 后,出现: ********************************************* ****************************** Warning: Applications/components generated using Microsoft Visual Studio 2008 require that the Microsoft Visual Studio 2008 run-time libraries be available on the computer used for deployment. To redistribute your applications/components, be sure that the deployment machine has these run-time libraries. ********************************************* **********
显示全部
相似文档