MATLAB: Specify compiler options for mex command

compilerMATLAB Compilermexoptimization flags

I compile C-Mex files with the Windows SDK7.1 compilers. Some C-Mex functions profit from the optimization flags "/GL /fp:fast", some other functions don't.
In e.g. Matlab <= R2011b I've created 2 different mexopts.bat files, one with these flags and the other without. Then
mex -f mexopts_Fast.bat ....
is used for compiling with these flags.
After upgrading to R2015b I find in the docs:
Do Not Use mex -f optionsfile Syntax
The mex command -f option to specify a build configuration file
will be removed in a future release.
How can I control the compiler's optimizations flags without using the -f syntax? I did not find a method to provide them as arguments for the mex command.

Best Answer

Maybe try some variant of the following:
filename = your source code file name
compiler_option = '/GL /fp:fast';
mex(filename,['COMPFLAGS="$COMPFLAGS ' compiler_option '"']);
Related Question