calling Matlab from Fortran using terminal

조회 수: 4 (최근 30일)
mary 2022년 11월 8일
댓글: Suvansh Arora 2022년 11월 14일
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:
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:
export PATH
After I try to execute fengdemo by typing
However, I have this error:
./fengdemo: error while loading shared libraries: 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.

답변 (1개)

Suvansh Arora
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
mary 2022년 11월 11일
편집: mary 2022년 11월 11일
Thank you Suvansh. However, I was aware of those links. I am able to run Fortran and Matlab functions from terminal.
My problem is that fengdemo does not work and I don't know why. I tried to execute a simpler example that is given here: but I had errors. I would be grateful if you tell me how to solve these errors.
Suvansh Arora
Suvansh Arora 2022년 11월 14일
One of the possible workarounds of the above-mentioned stack trace is mentioned in the article below:

댓글을 달려면 로그인하십시오.


Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by