You can call your own Fortran subroutines from the MATLAB command line as if they were built-in functions. These programs are called MEX files and the function name is the MEX file name.
To create a MEX file, write your programs using the MATLAB API libraries — Fortran MEX API and Fortran Matrix API. The
functions in these libraries facilitate the transfer of data between MEX files and
the workspace. For more information, see Fortran Source MEX Files. Then build the source file into an
executable program using the
mex function. For more information,
see Executable Fortran MEX Files.
If you have a Fortran program and want to call MATLAB functions, then use the MATLAB Engine API for Fortran engine library functions.
If you want to read and write MATLAB data from Fortran programs, then use the MATLAB Fortran API to Read MAT-File Data.