Skip to content

nexus_mex

miscellaneous · scripts/miscellaneous/nexus_mex.m

: nexus_mex option … source …
: [status, output] = nexus_mex (…)

Build a MEX file from C, CXX or Fortran source files, with the compiler of the system.

The sources may have the extensions .c, .cc, .cpp, .cxx, .f, .f90 or .for, and object files (.o, .obj, .a) may be given as well. The result is named after the first source, with the platform MEX extension from mexext (.mexa64 on 64-bit Linux, .mexw64 on 64-bit Windows, matching MATLAB R2026a), and is written to the current folder.

The options are those of the mex command of MATLAB:

-v

echo the compiler commands.

-g

keep debugging information.

-O

optimise (the default).

-Idir, -Ldir, -llib, -Dname[=value]

compiler and linker settings.

-output name

the name of the result, without extension.

-outdir dir

the folder for the result.

-largeArrayDims, -compatibleArrayDims

accepted; the large array interface is always used.

-R2018a

interleaved complex API (-DMX_HAS_INTERLEAVED_COMPLEX=1).

-R2017b

separate complex API (-DMX_HAS_INTERLEAVED_COMPLEX=0).

-silent

print nothing but errors.

-help

show the usage of the build tool.

With output arguments, status is 0 and output holds the text of the compiler. A failed build is always an error that carries the diagnostics of the compiler.