Main Content

Build and Run Fortran Engine Applications on Linux

This example shows how to build and run the fengdemo.F example on Linux® platforms.

Open MATLAB®.

Make note of the value of matlabroot (the folder where MATLAB is installed) command. You will use the value later to set the run-time library path in setenv commands.

matlabroot

Verify that your current folder is writable and copy the example.

copyfile(fullfile(matlabroot,'extern','examples','eng_mat',fengdemo.F'),'.','f')

Build the application.

mex -v -client engine fengdemo.F

Set the run-time library path. This command replaces the value, if any, in LD_LIBRARY_PATH. For more information, see Set Run-Time Library Path on Linux Systems.

setenv LD_LIBRARY_PATH matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

Set the path. Make sure that you include the : path terminator character.

setenv PATH matlabroot/bin:$PATH  

Run the example. The fengdemo application must be on your system path.

./fengdemo

MATLAB starts and displays a figure.

Type 1 <Enter> at the system prompt to continue and exit.

Related Examples

More About