Main Content


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 software components that run outside a MATLAB session using MATLAB Runtime libraries.


collapse all

You can access files included in a packaged application by using the which function, or by specifying the file location relative to ctfroot.

Add a file such as extern_app.exe to your MATLAB Compiler project.

Check if the code is running in deployed mode by using isdeployed. Then, obtain the path to the file by using the which function.

if isdeployed
    locate_externapp = which(fullfile('extern_app.exe'));
The which function returns the path to the file extern_app.exe, as long as it is located within the deployable archive.

For more information, see Access Files in Packaged Applications.

The path of a deployed application is fixed at compile time and cannot change. Use isdeployed to ensure that the application does not attempt to use path modifying functions, such as addpath, after deployment.

if ~(ismcc || isdeployed)

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

Use isdeployed with the %#exclude pragma to suppress compile time warnings for the non-deployable function edit.

if ~isdeployed
    %#exclude edit

The pragma excludes the function from dependency analysis during compilation.

Extended Capabilities

Version History

Introduced before R2006a