MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   运行Matlab脚本作为ExternalCode组件 (https://www.labfans.com/bbs/showthread.php?t=22418)

poster 2019-12-05 10:20

运行Matlab脚本作为ExternalCode组件
 
我正在尝试在openmdao中使用一些现有的matlab脚本。外部代码教程很容易理解。但是,在为Matlab应用程序修改以下示例时,我遇到了一些问题。教程中的原始代码:

self.options['command'] = ['python', 'extcode_paraboloid.py', self.input_file, self.output_file] 修改后的Matlab应用代码:

self.options['command'] = ['matlab', '-nodesktop -r "run Paraboloid.m"', self.input_file, self.output_file] 这行可以启动Matlab。但是,其他参数('-r“ test.m”)似乎已被截断,无法由matlab正确解释。我的替代解决方案是创建另一个.py文件以调用os命令。

os.system('cmd /c "matlab -nodesktop -r "run Paraboloid.m",quit"') 关于如何直接调用matlab函数的任何建议?谢谢!



[url=https://stackoverflow.com/q/59187224]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:25

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.