- Make sure you can run any simple FORTRAN program using Linux Terminal, follow the below mentioned article for more details: https://fortran-lang.org/en/learn/quickstart/hello_world/
- Make sure you can run MATLAB Function from Linux Terminal, follow the below mentioned article for more details: run-matlab-function-with-arguments-on-linux-terminal
- In order to know more about calling MATLAB code from Fortran program follow the article mentioned below: calling-matlab-engine-from-fortran-programs.html
- Simple program to illustrate, calling of MATLAB Engine function from a FORTRAN program: engopen_fortran.html#mw_7d2d018c-2868-4a73-9d06-46fe42607023
calling Matlab from Fortran using terminal
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
My objective is to call a matlab function within a fortran code by using the terminal and not Matlab command window. So, I tried to follow this example: https://www.mathworks.com/help/matlab/matlab_external/build-and-run-fortran-engine-applications-on-linux.html
I executed the command
mex -v -client engine fengdemo.F
in terminal. This creates an executable file called fengdemo
I set the library path using the following command format as mentioned here: https://www.mathworks.com/help/matlab/matlab_external/set-run-time-library-path-on-linux-systems.html
LD_LIBRARY_PATH=matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64:LD_LIBRARY_PATH
export LD_LIBRARY_PATH
PATH=matlabroot/bin:$PATH
export PATH
After I try to execute fengdemo by typing
./fengdemo
However, I have this error:
./fengdemo: error while loading shared libraries: libmx.so: cannot open shared object file: No such file or directory
I checked that glnxa64 is correctly located in matlabroot/sys/os. I don't know why I get these errors.
And finally, I would like to know how the command
gfortran -o binary_fengdemo fengdemo.F
used for fortran programs not including a call to matlab functions can be adapted for fortran programs including matlab calls.
댓글 수: 0
답변 (1개)
Suvansh Arora
2022년 11월 11일
In order to run MATLAB code within a FORTRAN code by using a Linux Terminal, follow the procedure mentioned below:
댓글 수: 2
Suvansh Arora
2022년 11월 14일
One of the possible workarounds of the above-mentioned stack trace is mentioned in the article below:
참고 항목
카테고리
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!