Main Content

Build and Run Fortran Engine Applications on Windows

This example shows how to verify the build process on Windows® platforms.

Use this Fortran® code.

 fengdemo.F

Make note of the value of matlabroot (the folder where MATLAB® is installed).

Start MATLAB and register MATLAB as a COM server. For more information, see Register MATLAB as COM Server.

comserver("register")

MATLAB displays a second, minimized command window. Close that window.

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

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

Choose a compiler, if necessary.

mex -setup -client engine Fortran

Build the application.

mex -v -client engine fengdemo.F

Set the run-time library path by modifying the system PATH variable. Make sure that you include the ; path terminator character.

set PATH=matlabroot\bin\win64;%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.

Alternatively, you can use an integrated development environment (IDE) such as Microsoft® Visual Studio® or Xcode to build your application.

See Also

| |

Topics