how to run much phyton script with matlab
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Aditya Gupta
le 24 Juin 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 commentaires
Voir également
Catégories
En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!