MEX with fortran object files

14 views (last 30 days)
Aaron
Aaron on 3 Jun 2011
Hi,
I have a fortran program that has a bunch of subroutines written. The code has go tos, etc..., so f2m programs have not been successful. I have investigated compiling the fortran code using mex within MATLAB, but have not been successful.
Alas, I have compiled the fortran script (subroutines.f) into (subroutines.o) object file using f77 compiler on a unix machine. Is there a way to use this object file inside MATLAB to call the functions defined in the fortran program, as if they were functions written in MATLAB?
If so, can someone post an example / tutorial on how to do this?
Thanks!

Answers (1)

Kaustubha Govind
Kaustubha Govind on 6 Jun 2011
You need to write a gateway C/FORTRAN MEX-function that calls into your object file. The documentation has a description and examples for such a function.

Categories

Find more on Fortran with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!