s2002teven
2008-10-16, 06:13
最近在做毕业设计,写了一个包含几个subfunction的m文件,但用profiler发现其中2个子函数运行很慢占用大量资源,于是想把这2个子函数编译成C代码。使用了matcom, mcc, comtool都失败了。偶然使用mcc -x命令时出现下面的话:
-x is no longer supported. The MATLAB Compiler no longer generates
MEX files because there is no longer any performance advantage to doing so: the
MATLAB JIT accelerates M-files by default.
也就是说m文件转换成C代码并用mex运行并不能提高运行速度?
但是在HELP文件里又发现下面的话:
Coding Loops in a MEX-File
If there are instances where you cannot vectorize and must use a for or while loop, consider coding the loop in a MEX-file. In this way, the loop executes much more quickly since the instructions in the loop do not have to be interpreted each time they execute.
也就是说有for语句时MEX确实能加速。
到底转换后会不会加速呢?我的子程序里确实有for语句且多次调用。我是matlab 7.0.1 R14
另实验室电脑装的是linux没有VC++。
如果我想把m文件转移到linux的平台没有matlab应该怎么做?
以上2个问题请教大家了,或有相关的网站或文章推荐,谢谢!:lovely:
-x is no longer supported. The MATLAB Compiler no longer generates
MEX files because there is no longer any performance advantage to doing so: the
MATLAB JIT accelerates M-files by default.
也就是说m文件转换成C代码并用mex运行并不能提高运行速度?
但是在HELP文件里又发现下面的话:
Coding Loops in a MEX-File
If there are instances where you cannot vectorize and must use a for or while loop, consider coding the loop in a MEX-file. In this way, the loop executes much more quickly since the instructions in the loop do not have to be interpreted each time they execute.
也就是说有for语句时MEX确实能加速。
到底转换后会不会加速呢?我的子程序里确实有for语句且多次调用。我是matlab 7.0.1 R14
另实验室电脑装的是linux没有VC++。
如果我想把m文件转移到linux的平台没有matlab应该怎么做?
以上2个问题请教大家了,或有相关的网站或文章推荐,谢谢!:lovely: