- Remove any functions from your app code that modify the search path, such as "addpath" or "path".
- Package any files/functions etc. that were accessed using "addpath" into the app at compilation. This can be done through the Application Compiler app by clicking the "plus" button in the "Files required for your application to run" box, or through the "mcc" command by using the "-a" flag. Examples of this flag's use can be found in the following link: MATLAB mcc
- Change your code based on the following instructions to access files packaged in the application: Specify File Names
"Modifying the search path on the MATLAB Compiler is unsupported" error with deployed app in R2019a and later
76 views (last 30 days)
Show older comments
MathWorks Support Team
on 17 Apr 2024
Edited: MathWorks Support Team
on 23 Aug 2024
I have an app that I was able to compile and deploy with MATLAB Compiler R2018b and earlier that is no longer able to be deployed when compiled with R2019a. I am getting the error below when I try to deploy my app, and it points me to the functions "addpath" and "path":
Error ID:
---------
'MATLAB:mpath:PathAlterationNotSupported'
--------------
Error Details:
--------------
Error using matlabpath
Modifying the search path is not supported by MATLAB Compiler. Remove functions that modify the search path from your MATLAB code. To make files visible to your deployed application, add the parent folder to your MATLAB session.
Error in path (line 109)
Error in addpath (line 86)
Why is this error occurring and how do I fix it?
Accepted Answer
MathWorks Support Team
on 23 Aug 2024
Edited: MathWorks Support Team
on 23 Aug 2024
Starting in R2019a, functions that modify the MATLAB search path are unsupported when using MATLAB Compiler. In a deployed application, the MATLAB path is fixed and cannot change. Therefore, any attempt to change these paths (using the "cd" command or the "addpath" command in your MATLAB code) fails. More information on this limitation and general rules for writing deployable MATLAB code can be found here:
Write Deployable MATLAB Code - MATLAB & Simulink (mathworks.com)
Apply the following changes to make your MATLAB code compatible for deployment with R2019a and beyond:
0 Comments
More Answers (0)
See Also
Categories
Find more on Standalone Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!