MATLAB: How to make the MATLAB Compiler 4.0 (R14) generated application skip the customized startup commands

avoidcompilecompilerdeploydeploymentdevelopmentMATLAB Compilermatlabrc.mstartup.mtarget

The MATLAB Compiler 4.0 (R14) runs all of the MATLAB startup scripts (matlabrc.m and startup.m) in my deployed application. Unfortunately, I have custom code in those scripts that sets up my environment in a way I do not want the environment set on the target system. For instance, I set many things to help me debug and I do not want the deployed application configured this way.

Best Answer

There is currently no automatic way to instruct the MATLAB Compiler to skip the startup scripts in the deployed application. However, you can work around this by using the function ISDEPLOYED in your startup scripts. ISDEPLOYED allows you to determine whether your application is running in standalone mode or from within MATLAB.
For example you may use a structure such as the following in your startup scripts:
if (~isdeployed)
%run some development machine specific code
end
to run code only on the development machine and not the target machine.