system or unix command run compiled fortran binary fails, but it runs fine from a terminal
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2012-5-16
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 个评论
更多回答(2 个)
Shan Dou
2014-3-4
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fortran with MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!