matlab如何生成exe生成的exe运行很慢怎么处理

查看: 8756|回复: 11
如何在matlab中生成dll文件供labview调用
急用啊!有详细的步骤提供一下!
网上找下学习资料吧
MATLAB6.5应用接口编程
里面有讲,你可以搜一下
matlab下生成的dll实际上还是com控件,可以自动生成注册文件,运行即可注册。我实际使用了,发现存在2个问题:
1、速度很慢;
2、数组类型不工作;只可以在参数为数字时候正确。
2006a版本以前可以输入comtool,即可。
在2006a版本以后,就是输入:dotnettool,然后弹出一个对话框的生成东西,只要简单的配置,就可以了,或者在matlab的帮助文件里面输入dotnettool。
我做了一个例子,大家可以自己学习学习如何生成,调用的部分labVIEW7.1程序我也附加了一个,里面是2个m文件,一起添加进去,build成com即可。
在C盘放上一个图片为: 1.jpg 即可
请看效果图。
[ 本帖最后由 wdyjz 于
15:07 编辑 ]
本帖子中包含更多资源
才可以下载或查看,没有帐号?
&&thanks&&for everyone^^
不过我不知道为什么在自己的机子上写个简单的m都没办法生成build com 老是提示出错!
对matlab不熟啊!能有个图解就好了!呵呵
wdyjz兄如果不嫌麻烦的话&&做个matlab生成dll的详细步骤图解&&教教我们这些菜鸟吧~~
好的。明天我有时间搞一个,让兄弟们看看。不过别人做的有现成的,写的有现成的文章,还是看别人的吧。
matlab7.0以前输入:comtool
2006a开始:donnettool
最好安装visual studio .net2003或者其后面的更新版本。
[ 本帖最后由 wdyjz 于
10:14 编辑 ]
Building standalone executable...
mcc -M -silentsetup -d 'C:/MATLAB6p5/work/src'&&-B 'csglcom:comtest,sgltest,1.0'&&-i C:/MATLAB6p5/work/im_test.m C:/MATLAB6p5/work/split2rgb.m& &
&&MBUILD.BAT: Error: The chosen compiler does not support building COM objects.
& & & & Please see the MATLAB Add-in for Excel documentation for the latest list of supported compilers.
wdyjz兄 这是怎么一会事??帮我解答下哦!
[ 本帖最后由 shihuangjj 于
12:31 编辑 ]
最好安装visual studio .net2003或者其后面的更新版本。
设置下编译器,里面有个命令的。
[ 本帖最后由 wdyjz 于
14:06 编辑 ]
本帖子中包含更多资源
才可以下载或查看,没有帐号?
&& 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 C version 2.4.1 in C:\PROGRAM FILES\MATLAB\R2006A\sys\lcc
[2] Microsoft Visual C/C++ version 8.0 in D:\Program Files\Microsoft Visual Studio 8
[3] Microsoft Visual C/C++ version 7.1 in C:\Program Files\Microsoft Visual Studio .NET 2003
[4] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft Visual Studio
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C/C++ 8.0
Location: D:\Program Files\Microsoft Visual Studio 8
Are these correct?([y]/n): y
****************************************************************************
&&Warning: Applications/components generated using Microsoft Visual Studio& &
& && && &&&2005 require that the Microsoft Visual Studio 2005 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. More information
& && && &&&is at:& && && && && && && && && && && && && && && && && && && && &
& && && &&&& &&&
****************************************************************************
Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2006a\compopts.bat
From template:& && && && &&&C:\PROGRAM FILES\MATLAB\R2006A\BIN\win32\mbuildopts\msvc80compp.bat
Done . . .
--& &&C:\Program Files\MATLAB\R2006a\bin\win32\mwregsvr& &C:\Program Files\MATLAB\R2006a\bin\win32\mwcomutil.dll&&
DllRegisterServer in C:\Program Files\MATLAB\R2006a\bin\win32\mwcomutil.dll succeeded
--& &&C:\Program Files\MATLAB\R2006a\bin\win32\mwregsvr& &C:\Program Files\MATLAB\R2006a\bin\win32\mwcommgr.dll&&
DllRegisterServer in C:\Program Files\MATLAB\R2006a\bin\win32\mwcommgr.dll succeeded
Building a Deployable Application
The steps to create a COM component are very similar to the steps described in How to Create a .NET Component. Here is a brief summary of the steps:
If you have not already done so, execute the following command in MATLAB:
mbuild -setup
Be sure to choose a supported compiler. See Compiler Requirements.
Type dotnettool at the command line in MATLAB to open the MATLAB Builder dialog box.
Click File & New & Project to open the New Project Settings dialog box.
Specify names for the component and at least one class that will be part of the component.
Accept the current settings by clicking OK.
.NET Builder creates and saves a project file named component_name.cbl in the project directory.
The project file is part of your project workspace. It contains the names of any M-files or MEX-files you subsequently add to the project. Adding these files is the next step.
Click Add File to add methods to the component classes.
Click Build & COM Object to build the project.
The build process sends intermediate source files to the \src sub-directory and output files necessary for deployment to the \distrib sub-directory of your project directory. The files in \distrib are DLLs, which are automatically registered on your system.
You probably want to test your component before packaging, which is the next step. After testing the component outside of the MATLAB environment you can reopen the project and proceed to the next step.
Click Component & Package Component to create a self-extracting executable. .NET Builder names this file componentname.exe.
Files in the self-extracting executable
FilePurposecomponentname.ctf
Component Technology File (ctf) archive. This is a platform-dependent file that must correspond to the end user'ponentname_projectversion
Component that encapsulates M-code_install.bat
Script run by the self-extracting executableMCRInstaller.exe
Self-extracting MATLAB Component Run platform-dependent file that must correspond to the end user's platform.
MCRInstaller.exe installs MATLAB Component Runtime (MCR), which users of your component need to install on the target machine once per release.
Distribute the self-extracting executable to your users.
学习了,但是没学会
Powered by

我要回帖

更多关于 matlab生成exe文件 的文章

 

随机推荐