通过运行批处理在Windows OS&QUOT多个m文件;不"收盘previously运行m文件 [英] Running multiple m-files by batch on Windows OS "without" closing previously run m-file
问题描述
我的目的是按顺序运行一系列M文件和Python程序。
My purpose is to sequentially running a series of m-file and python programs.
和感谢渔业部,夏嘉曦和moarningsun,我可以找出此批处理文件是成功的在我的Windows操作系统:
And thanks to Mofi, Shai, and moarningsun, I could find out that this batch file is successful on my Windows OS:
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
,那么 python.py
,那么 aatest2。米
。
然而,由于这种运行后 aatest1.m
, aatest2.m
关闭MATLAB不能使用所取得的变量 aatest1.m
。
However, since this closes MATLAB after running aatest1.m
, aatest2.m
cannot use the variables made by aatest1.m
.
我怎样才能code批次让 aatest2.m
可以使用从 aatest1.m $ C $做出的变量C>?
How can I code the batch so that aatest2.m
can use the variables made from aatest1.m
?
推荐答案
您可以 保存
所有相关变量的垫子文件在 aatest1
的结束和的 >负荷
他们在 aatest2
Option 1:
You can save
all the relevant variables to a mat file at the end of aatest1
and load
them at the begining of aatest2
.
您可以(不终止 aatest1
)运行在MATLAB中的python脚本。结果
利用MATLAB的 系统
命令来运行在Matlab Python脚本
You can run your python script in matlab (without terminating aatest1
).
Use matlab's system
command to run the python script in Matlab:
[status,cmdout] = system( 'C:\python27\python.exe python.py input.xlsx' );
这篇关于通过运行批处理在Windows OS&QUOT多个m文件;不"收盘previously运行m文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!