User`s manual
6 Importing and Exporting Data
6-30
Using the Options File
MATLAB provides an options file, matopts.sh, that lets you use the mex script
to easily compile and link MAT-file applications. For example, to compile and
link the
matcreat.c example, you can use
mex -f <matlab>/bin/matopts.sh <pathname>/matcreat.c
where <pathname> specifies the complete path to the specified file.
If you need to modify the options file for your particular compiler or platform,
use the
-v switch to view the current compiler and linker settings and then
make the appropriate changes in a local copy of the
matopts.sh file.
Compiling and Linking on Windows
To compile and link Fortran or C MAT-file programs, use the mex script with a
MAT options file. Table 1-2, Options Files, on page 1-17 lists the MAT options
files included in this release. All of these options files are located in
<
matlab>\bin\win32\mexopts.
As an example, to compile and link the stand-alone MAT application
matcreat.c on Windows using MSVC (Version 5.0), use
mex -f <matlab>\bin\win32\mexopts\msvc50engmatopts.bat <pathname>\matcreat.c
where <pathname> specifies the complete path to the specified file. If you need
to modify the options file for your particular compiler, use the
-v switch to view
the current compiler and linker settings and then make the appropriate
changes in a local copy of the options file.