声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3388|回复: 12

[综合讨论] 怎么将M文件转成EXE文件 阿

[复制链接]
发表于 2006-11-10 15:58 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我编写了一个 M文件,如何把它编译成EXE文件阿,请高手指点 !1
回复
分享到:

使用道具 举报

发表于 2006-11-10 16:05 | 显示全部楼层
原帖由 hanwus 于 2006-11-10 15:58 发表
我编写了一个 M文件,如何把它编译成EXE文件阿,请高手指点 !1


忘记毛主席的教诲了吗?——自己动手,丰衣足食

搜索一下论坛就ok了
 楼主| 发表于 2006-11-10 16:12 | 显示全部楼层
找了半天没找到
发表于 2006-11-10 20:39 | 显示全部楼层

那个高手说详细点啊!

那个贴字好像不太清楚,刊不太懂,那位能不能给个例子说清楚怎么生成exe啊?
发表于 2006-11-11 14:09 | 显示全部楼层
原帖由 action 于 2006-11-10 20:39 发表
那个贴字好像不太清楚,刊不太懂,那位能不能给个例子说清楚怎么生成exe啊?


如果论坛上的帖子还是看不明白的话,自己去看书好了
发表于 2006-11-12 15:28 | 显示全部楼层
好象是用mcc这个命令
mcc -W main:exe -T  ***.m
好象是这样的楼主可以在matlab的帮助文档上查查,确认一下。

评分

1

查看全部评分

发表于 2006-11-15 21:16 | 显示全部楼层
mcc -W main  -T  link:exe ***.m
发表于 2006-11-16 13:27 | 显示全部楼层
强烈建议你买<<精通matlab6.5>>
后面专门讲了关于生成.exe文件的方法
发表于 2006-11-16 16:32 | 显示全部楼层
我也要把它独立出来,谢谢F117_ren_0介绍的书,我好好看一下。
发表于 2006-11-17 22:00 | 显示全部楼层
我说的那个方法是可行的,我已经试过了,直接在命令行运行mcc -W main -T link:exe ***.m就可以生成EXE文件和其他的文件了,但是只要保留.exe文件和.ctf文件就行。

另外楼主可以把邮箱给我,我给你传份pdf格式的 《精通matlab6.5 (北航 张志涌)》
发表于 2006-11-30 15:19 | 显示全部楼层
有很多种方法可以实现,MATLAB内在的编译器,MATCOM等等,具体可以到http://www.cnitblog.com/edaiqingwa/看看。
发表于 2006-11-30 17:48 | 显示全部楼层

为什么我用 snowlion1111的办法出错呢?

为什么我用 snowlion1111的办法出错呢?
>> mcc -W main -T link:exe exe.m
Warning: File: c:\matlab6p5p1\exe\exe.m Line: 4 Column: 1
References to "plot" require the C/C++ Graphics Library when executing in stand-alone mode. You must specify -B sgl or -B sglcpp in order to use the C/C++ Graphics Library. Also, if using the -W option, you must specify either the mainhg or libhg wrapper type. A run-time error will occur if the C/C++ Graphics Library is not present when "plot" is called.
lcc preprocessor error: exe_main.c:15 Could not find include file "exe.h"
Error exe_main.c: 19  undeclared identifier `mlxExe'
Error exe_main.c: 19  invalid initialization type; found `int' expected `pointer to void function(int,pointer to pointer to incomplete struct mxArray_tag defined at C:\MATLAB6p5p1\extern\include\matrix.h 160,int,pointer to pointer to incomplete struct mxArray_tag defined at C:\MATLAB6p5p1\extern\include\matrix.h 160)'
Error exe_main.c: 19  initializer must be constant
Error exe_main.c: 19  undeclared identifier `_local_function_table_exe'
Warning exe_main.c: 19  assignment of pointer to struct _mexLocalFunctionTable to pointer to int
Error exe_main.c: 22  undeclared identifier `InitializeModule_exe'
Error exe_main.c: 22  invalid initialization type; found `int' expected `pointer to void function(void)'
Error exe_main.c: 22  initializer must be constant
Error exe_main.c: 22  undeclared identifier `TerminateModule_exe'
Error exe_main.c: 22  invalid initialization type; found `int' expected `pointer to void function(void)'
Error exe_main.c: 22  initializer must be constant
Error exe_main.c: 34  type error in argument 3 to `mclMain'; found `int' expected `pointer to void function(int,pointer to pointer to incomplete struct mxArray_tag defined at C:\MATLAB6p5p1\extern\include\matrix.h 160,int,pointer to pointer to incomplete struct mxArray_tag defined at C:\MATLAB6p5p1\extern\include\matrix.h 160)'
12 errors, 1 warnings

  MBUILD.BAT: Error: Compile of 'exe_main.c' failed.

??? Error using ==> mbuild
Unable to complete successfully

??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable (specify the -v option for more information).

Error in ==> C:\MATLAB6p5p1\toolbox\compiler\mcc.dll
发表于 2006-11-30 17:53 | 显示全部楼层

这是我的程序

function a()
x=0:0.01*pi:4*pi;
y=sin(x);
plot(x,y)
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 23:27 , Processed in 0.059809 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表