在 Windows 操作系统上批量运行多个 m 文件,“无需”关闭先前运行的 m 文件

2023-12-26

我的目的是顺序运行一系列m文件和python程序。

感谢 Mofi、Shai 和 moarningsun,我发现这个批处理文件在我的 Windows 操作系统上是成功的:

start "01" /wait "C:\Program Files\MATLAB\R2012a\bin\matlab.exe" -wait -r "aatest1; exit;"
start "02" /wait "C:\python27\python.exe" python.py input.xlsx
start "03" /wait "C:\Program Files\MATLAB\R2012a\bin\matlab.exe" -wait -r "aatest2; exit;"

它将运行aatest1.m, then python.py, then aatest2.m.

但是,由于这会在运行后关闭 MATLABaatest1.m, aatest2.m不能使用由aatest1.m.

我怎样才能对批次进行编码,以便aatest2.m可以使用由以下内容组成的变量aatest1.m?


选项1:

You can save http://www.mathworks.com/help/matlab/ref/save.htmlmat 文件末尾的所有相关变量aatest1 and load http://www.mathworks.com/help/matlab/ref/load.html他们在开始时aatest2.

选项2:

您可以在 matlab 中运行 python 脚本(无需终止aatest1).
使用matlab的system http://www.mathworks.com/help/matlab/ref/system.html运行 python 脚本的命令在Matlab中:

[status,cmdout] = system( 'C:\python27\python.exe python.py input.xlsx' );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Windows 操作系统上批量运行多个 m 文件,“无需”关闭先前运行的 m 文件 的相关文章

随机推荐