system or unix command run compiled fortran binary fails, but it runs fine from a terminal
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Derek
le 16 Mai 2012
Réponse apportée : Shan Dou
le 4 Mar 2014
Hi, I'm trying to get matlab to start up a compiled fortran program with the unix or system commands. To do this, I fill "str" with the required information, and then call unix(str). However, the fortran program won't run when I call it from matlab, but works just fine when I call it from a terminal window.
This is the string I am sending:
/home/derek/Research/2Layer_new/src/seis-spread-response-sameani /home/derek/Data/tables/GSN_SKS_Nov_2011_best/1_Layer_flat/model.synthetics /home/derek/Data/tables/GSN_SKS_Nov_2011_best/1_Layer_flat/geometry /home/derek/Data/tables/GSN_SKS_Nov_2011_best/1_Layer_flat/phasefile /home/derek/Data/tables/GSN_SKS_Nov_2011_best/1_Layer_flat/arrivalfile /home/derek/Data/tables/GSN_SKS_Nov_2011_best/1_Layer_flat/traces.out SV
and this is the output:
/home/derek/Research/2Layer_new/src/seis-spread-response-sameani: /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /home/derek/Research/2Layer_new/src/seis-spread-response-sameani)
Like I said above, I can take the value in str and cut and paste it to a terminal window, and the fortran code runs fine. I've tried both the system and unix commands, and also confirmed that the MATLAB_SHELL environmental variable is set to the shell I I am using. Apparently there is something I don't understand about how matlab does a system command, but I can't seem to find any useful information. Does anyone have a clue? Thanks.
0 commentaires
Réponse acceptée
Walter Roberson
le 16 Mai 2012
compare
getenv('LD_LIBRARY_PATH')
!ldd /home/derek/Research/2Layer_new/src/seis-spread-response-sameani
inside MATLAB, to
echo $LD_LIBRARY_PATH
ldd /home/derek/Research/2Layer_new/src/seis-spread-response-sameani
from the terminal window. You might need some options to ldd.
0 commentaires
Plus de réponses (2)
Shan Dou
le 4 Mar 2014
After our matlab gets updated to R2013b, I still have the same issue with gfortran, even though the version of gfortran is supposed to be compatible with R2013b. The temporary solution that works for me is to use g77 instead of gfortran.
0 commentaires
Voir également
Catégories
En savoir plus sur Fortran with MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!