how to run much phyton script with matlab
1 次查看(过去 30 天)
显示 更早的评论
hei matlab users,
I need to run much phyton scripts to request some data from ECMWF database. I have write this scripts but when i run the first of them matlab waits its end while I want run all my scripts togheter: I need it because every requestes have to be elaborated and I obtain the data after much hours/days.
In this moment I have a crude solution:
% 1) run this line
k=0;
name_of_my_script=[name1, name2, name3, etc];
%%
%2) run this section
k=k+1;
system(['python' name_of_my_script(k) '.py'])
%3) Ctrl+C in the command window
%4) run the second section
%5) Ctrl+C in the command window
%6) run the second section
%) etc.
0 个评论
回答(1 个)
Aditya Gupta
2020-6-24
You can alternatively create a temporary bash script using file operations (and - ofcourse - loops) of the following format:
python script1.py &
python script2.py &
python script3.py &
python script4.py &
That's the entire script. It will run the four Python scripts at the same time. The "&" shell operator tells each process to go into the background
Now use the system command to run this script inside the matlab script.
Dont forget to delete the temporary file.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!