Main Content

isdeployed

Determine whether code is running in deployed or MATLAB mode

Description

example

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.

Examples

collapse all

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 print, to send data to a printer.

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

Extended Capabilities