how to run much phyton script with matlab
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Aditya Gupta
on 24 Jun 2020
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 Comments
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!