MATLAB: How to know what compiler has been chosen previously using the “mbuild -setup” function

-setupcompilerMATLAB Compilerr14sp2

I use "mbuild -setup" to choose the compiler. I work with different compilers to build standalone MATLAB applications. I am forced to run "mbuild -setup" every time to ensure that I am using the right compiler. I would like to know if there is any command that I could use to find out the compiler that is currently chosen.

Best Answer

There is no function available to find out the compiler chosen using "mbuild -setup" in MATLAB Compiler.
To work around this issue, use the following code to read the first line of "compopts.bat" file which provides the information about the compiler chosen:
fid = fopen(fullfile(prefdir,'compopts.bat'),'r');
fgetl(fid);
disp(fgetl(fid));
fclose(fid);
For all platforms other than Windows, MATLAB Compiler has generally only supported one compiler for each release so there is no need to determine which compiler has been selected with "mbuild -setup" as there is only one option. For details on supported compilers please see the following web page: