isdeployed - Determine whether code is running in deployed or MATLAB mode - MATLAB (original) (raw)
Main Content
Determine whether code is running in deployed or MATLAB mode
Syntax
Description
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.
Examples
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 usingisdeployed
. Then, obtain the path to the file by using the which
function.
if isdeployed locate_externapp = which(fullfile('extern_app.exe')); end
Thewhich
function returns the path to the fileextern_app.exe
, as long as it is located within the deployable archive.
For more information, see Include and 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 asaddpath
, after deployment.
if ~(ismcc || isdeployed) addpath(mypath); end
Before R2024b: You cannot use thedoc
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
Use isdeployed
with the %#exclude pragma to suppress compile time warnings for the non-deployable function edit
.
if ~isdeployed %#exclude edit edit('readme.txt'); end
The pragma excludes the function from dependency analysis during compilation.
Extended Capabilities
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.
Version History
Introduced before R2006a