Contenu principal

Limitations for MATLAB Compiler and MATLAB Compiler SDK

R2026b

MATLAB® Compiler™ supports core MATLAB language features, including functions, classes, and objects. It can package many MATLAB and toolbox capabilities for deployment.

Deployed applications and components do not support every MATLAB and toolbox feature. Use these references to confirm whether specific functionality is deployable:

CategoryDescription
Support for MATLAB, Simulink, and Toolboxes Use this page as the primary reference for product and feature support in deployed mode.
Functions Not Supported for Compilation by MATLAB Compiler and MATLAB Compiler SDKUse this page to identify commonly encountered non-deployable functions and categories.

Compiled applications run only on operating systems that support MATLAB. Components that MATLAB Compiler generates cannot be used inside MATLAB. MATLAB Runtime is approximately the same size as MATLAB, so deployed applications require adequate storage and memory. For current requirements, see MATLAB System Requirements.

For multiplatform considerations, see Ensure Multiplatform Portability for Compiled Applications.

Before You Start Checklist

  • Confirm that your required toolbox features are supported for deployment, using Support for MATLAB, Simulink, and Toolboxes.

  • Avoid using callback strings for critical application behavior.

  • Decide how you will package required data files and how you will locate them at run time.

  • Decide whether your application needs Java®. As of R2026b, Java is no longer installed with MATLAB or MATLAB Runtime. If your application requires Java, install a compatible OpenJDK® distribution on the target machine. For details, see Use Java Runtime Environment (JRE) with MATLAB Runtime. If your application uses graphics, do not use -nojvm.

Design-Time Constraints

To write code that can be successfully packaged, review these limitations and their workarounds before you design your application.

AreaLimitationWorkaround
Shipped GUIs and apps (Not Supported)Many prebuilt interactive interfaces included in MATLAB toolboxes are not deployable.Use programmatic workflows and confirm support early.
Desktop features (Not Supported)Interactive tools and environment panels are unavailable in deployed mode.Avoid reliance on desktop-only features.
Non-programmatic workflows (Not Supported)Some functionality cannot be invoked reliably in deployed mode if it cannot be called directly from the command line.Replace with programmatic equivalents.
Workspace control (Restricted)Deployed applications cannot dynamically manipulate local or base workspaces at run time using eval, evalin, or assignin.Avoid using string evaluations to create or modify variables dynamically.
Parallel pools (Restricted to max 1 pool)

Deployed applications that use a shared MATLAB Runtime instance or singleton runtime cannot use more than one parallel pool. Parallel Computing Toolbox™ functionality is not supported in MATLAB Compiler SDK™ C++ shared libraries using the MATLAB Data API interface in MATLABApplicationMode::OUT_OF_PROCESS mode.

To use thread-based parallel pools (parpool("Threads")) in deployed applications, set the MW_MULTIMCOS_MODE environment variable to 1 before launching the application.

Refactor your code to create multiple MATLAB Runtime processes.
Licensing restrictions (Restricted)Some capabilities are restricted by design or underlying licensing constraints in deployed mode.Verify support and licensing requirements before running a build.

Build and Packaging Constraints

Accepted File Types by Deployment Target

Valid and invalid file types depend on the deployment target. Each entry-point file must have only one entry point.

TargetValid entry point file typesInvalid entry point file types
Standalone applicationsMATLAB MEX files, MATLAB scripts, MATLAB functions, MATLAB class files, protected function files with the .p extensionJava functions, COM components, .NET components, data files
C shared libraries, C++ shared libraries, .NET assemblies, Java packages, Python® packages, COM componentsMATLAB MEX files, MATLAB functions, MATLAB class filesMATLAB scripts, protected function files with the .p extension, Java functions, COM components, .NET components, data files
Web appsMATLAB apps in binary format (.mlapp), MATLAB apps in plain text format (.m)MATLAB MEX files, MATLAB scripts, MATLAB class files, protected function files with the .p extension, Java functions, COM components, .NET components, data files
MATLAB Production Server™ archivesMATLAB functions, protected function files with the .p extensionMATLAB scripts, MATLAB MEX files, MATLAB class files, MATLAB live scripts (.mlx), Java functions, COM components, .NET components, data files. MATLAB class files can be dependent files.
MicroservicesMATLAB functions, protected function files with the .p extensionMATLAB scripts, MATLAB MEX files, MATLAB class files, MATLAB live scripts (.mlx), Java functions, COM components, .NET components, data files. MATLAB class files can be dependent files.
  • When you use a P-code file (.p) as an entry point, dependency analysis cannot discover the functions and classes the file calls. You must explicitly include all required dependencies, using the AdditionalFiles option, the -a flag with mcc, or the Custom Requirements section of a compiler app.

  • For MATLAB Production Server archives, you can include MATLAB class files as dependent files.

  • You can add other types of files to the packaged archive, including data files. For details, see Include Additional Files in Packaged Applications.

Dependency Analysis Limitations

MATLAB Compiler packages the MATLAB files that you specify and any additional MATLAB files that those files call. MATLAB Compiler uses dependency analysis to determine required functions and classes.

Dependency analysis can miss functions when a function name appears only at run time or is hidden from static analysis. This table describes common patterns that cause missed dependencies.

Common Patterns and Fixes

PatternProblemRecommended Fix
Function name appears only in a callback specified as a text stringDependency analysis does not parse callback strings for function namesUse function handles instead of callback strings, or use the %#function pragma to explicitly include the function
Function name appears only in a character array passed to feval or an ODE solverThe function name is available only at run timeAdd %#function or include the file explicitly using AdditionalFiles, -a, or the Custom Requirements section of a compiler app
Dependent functions stored in MAT files that are loaded at run timeStatic dependency analysis cannot discover dependencies in MAT filesInclude required files explicitly using AdditionalFiles, -a, or the Custom Requirements section of a compiler app
P-code file where the original MATLAB source is unavailableDependency analysis cannot discover dependencies from P-code aloneInclude all required dependencies explicitly using AdditionalFiles, -a, or the Custom Requirements section of a compiler app

Find Missing Functions in MATLAB Files.  To identify candidates for explicit inclusion, search your source code for these patterns:

  • Callback properties specified as text strings, including properties ending in Fcn

  • Text arguments passed to feval, fminbnd, fminsearch, funm, fzero, and ODE solvers

Cannot Create Output File

If you see an error such as Can't create the output file filename, check for these common causes:

  • No write permission to the output folder

  • Insufficient free disk space in the output folder

  • A previously launched executable still running and preventing overwrite

Packaged Help Text Is Not Available

For performance reasons, MATLAB file comments are removed before MATLAB Runtime encryption. If you package a MATLAB file that contains help text in comments, the output of help filename can be unintelligible in deployed mode.

Runtime Constraints

Java and Graphics

As of R2026b, Java is no longer installed with MATLAB or MATLAB Runtime. If your deployed application requires Java (for example, for Java database access using JDBC or Java-based third-party libraries), you must install a compatible OpenJDK distribution on the target machine. For details, see Use Java Runtime Environment (JRE) with MATLAB Runtime.

If your program uses graphics and you compile it with -nojvm, the deployed application can throw an error at run time. If your application requires graphics, do not use -nojvm.

On Linux®, if Java is not installed or not on the library path, you might see warnings related to libjvm.so. To resolve these warnings, install OpenJDK and set the MATLAB Runtime library path appropriately. For details, see Set MATLAB Runtime Library Paths for Deployment.

File Location and Discovery Differences

In deployed applications, using which does not search the current working folder. Using open can also lead to unexpected results if your application relies on current folder search.

Use one or more of these alternatives:

  • Use load or a file-type-specific reader that checks the current folder explicitly.

  • Use ctfroot to locate files that are packaged with the deployable archive.

  • Include the file as an additional packaged file and then locate it using a documented deployment file access workflow.

For details, see Include Additional Files in Packaged Applications.

Restrictions on Calling printdlg with Multiple Arguments in Packaged Mode

In deployed mode, printdlg accepts only one input argument. Calls that provide multiple arguments can fail in deployed applications, even if they work in MATLAB.

Language Binding Constraints

C++ mwArray Resizing

In C++, mwArray does not support dynamic resizing using SetData. Allocate the required size before you call SetData, or create a new mwArray with the desired size.

Quick Troubleshooting Guide

Use this table to diagnose common deployment run-time errors:

ErrorLikely CauseRelevant Section
UI element does not respondMissing packaged dependency due to indirect referenceDependency Analysis Limitations
Unknown function error in deployed modeIndirect call via callback string or fevalDependency Analysis Limitations
Graphics fails at run time-nojvm used with graphicsJava and Graphics
Java-related error or libjvm.so warning at run timeOpenJDK not installed on target machineJava and Graphics
File cannot be foundCurrent folder search differs in deployed modeFile Location and Discovery Differences
printdlg fails in deployed modeMultiple input arguments not supportedRestrictions on Calling printdlg with Multiple Arguments in Packaged Mode
Cannot create output filePermissions, disk space, executable still runningCannot Create Output File

See Also

Topics

External Websites