如何在.m文件中调用.exe文件(由独立Simulink模型制成)? [英] how to call .exe file (made from standalone Simulink model) in .m file?
问题描述
当我使用
!mdlname -p file.mat
在Matlab的命令窗口中,我没有任何错误,但是当我在.m文件中使用命令时,出现错误,提示找不到Mat文件.我试图像这样放置file.mat的完整路径名
in command window of Matlab I have no errors, but when I use the command in .m file I get error that says that mat file can not be located. I tried to put full path name for file.mat like this
!mdlname -p c:\ path .. \ file.mat
!mdlname -p c:\path..\file.mat
但是我仍然收到错误消息,说找不到找不到Mat文件(从mat文件读取参数数据时出错)
but I still get error saying mat file can not be found (error reading parameter data from mat-file)
我尝试在m文件中使用函数system
,它可以工作,但我不能像-p
那样强制函数system
使用file.mat.
I tried using function system
in m file and it works but I can't force function system
to use file.mat like I can with -p
.
推荐答案
system(['"zbroj.exe" -p zbro.mat']);
这是解决方案,我尝试过并且尝试过并最终成功了. zbroj.exe 是simulink模型中的一个rsim exe, -p 是一个开关,它强制 zbroj.exe 从获取输入参数zbro.mat 文件.
here is the solution, i tried and i tried and finally made it. zbroj.exe is a rsim exe from simulink model, -p is a switch that forces zbroj.exe to take input parameters from zbro.mat file.
这篇关于如何在.m文件中调用.exe文件(由独立Simulink模型制成)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!