Determine whether code is running in deployed or MATLAB mode
x = isdeployed returns logical 1 (
true) when the function is running in deployed mode using MATLAB® Runtime and 0 (
false) if it is running in a MATLAB session.
An application running in deployed mode consists of a collection of MATLAB functions and data packaged using MATLAB Compiler™ into a standalone executable or shared library that runs outside of a MATLAB session using MATLAB Runtime libraries.
The path of a deployed application is fixed at compile time and cannot change. Use
isdeployed to ensure that the application uses
addpath before deployment.
if ~(ismcc || isdeployed) addpath(mypath); end
Deployed applications must use
deployprint, rather than
if ~isdeployed print else deployprint end
You cannot use the
doc function to open the Help browser
from a deployed application. Instead, redirect a help query to the MathWorks® website.
if ~isdeployed doc(mfile); else web('https://www.mathworks.com/support.html'); end
Usage notes and limitations:
Returns true and false as appropriate for MEX targets.
Returns false for SIM targets, which you should query using
coder.target (MATLAB Coder).
Returns false for other targets.