- 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
69 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2024-4-17
编辑: MathWorks Support Team
2024-8-23,16:05
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?
采纳的回答
MathWorks Support Team
2024-8-23,0:00
编辑:MathWorks Support Team
2024-8-23,16:05
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standalone Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!