system or unix command run compiled fortran binary fails, but it runs fine from a terminal
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 16 May 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 Comments
More Answers (2)
Shan Dou
on 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 Comments
See Also
Categories
Find more on Fortran with MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!