Input environment variable into script to run different values automatically
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
In-chan Kim
le 27 Mai 2020
Réponse apportée : Image Analyst
le 27 Mai 2020
Hi, I'm running a matlab script on a different server, and I want it to automatically input a value into a script, so that I can run it once, and have different versions of the scrips running independently.
I know that if I use something called an environment variable, it will work, I just don't know how!
From the server side of things:
#PBS -J 1-5
matlab -nodesktop -nosplash -nodisplay < RunHPC_parallel${PBS_ARRAY_INDEX}s.m
And that will make it
RunHPC_parallel1s.m, RunHPC_parallel2s.m ... RunHPC_parallel5s.m
I need to be able to make the J feed into my script and adjust a value within my script.
Specifically, the J in
formparams=form2params(J,:);
I think it's something to do with this: ${PBS_ARRAY_INDEX}
But not sure how!
Thanks!
0 commentaires
Réponse acceptée
Image Analyst
le 27 Mai 2020
You can get the environment variable inside your program with getenv().
Description
value = getenv(name) searches the operating system environment variable list for text of the formname=value.
On UNIX® platforms, the shell you use to start MATLAB® determines the operating system environment. For example, starting MATLAB on a Mac platform from the Applications folder creates a different shell environment from starting MATLAB from Terminal.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Enterprise Deployment with MATLAB Production Server 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!