Modifying the search path is not supported by Matlab Compiler?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aram Zeytunyan
am 23 Apr. 2024
Kommentiert: Steven Lord
am 24 Apr. 2024
Trying to create a Matlab app in R2023b. The deployed application should connect to a Moku:Go device (which is using its own Matlab toolbox) and take some measurements. The app is running smoothly when running from Matlab, but giving an error message when running from the deployed standalone app.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1677576/image.png)
I have looked at the following topic: https://www.mathworks.com/matlabcentral/answers/1786755-modifying-the-search-path-is-not-supported-by-matlab-compiler?s_tid=sug_su
I have added the following line in my Matlab startup code and have made sure that all the required Moku files are embedded during the app deployment:
addpath(genpath('C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\moku-MATLAB(2)'))
Please advise what can be done to have the deployed app running.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 23 Apr. 2024
Try taking that line of code out of your program. To add files that the compilation process may not see and automatically include you can use the '-a' option of mcc.
0 Kommentare
Weitere Antworten (2)
Steven Lord
am 23 Apr. 2024
See the "Do Not Rely on Changing Directory or Path to Control the Execution of MATLAB Files" section on this documentation page. If you need to add a directory to the MATLAB search path in order for the files it contains to be visible to MATLAB Compiler, do so before trying to create the application rather than inside the application itself. Or use the -a option for mcc as Image Analyst suggested. Also see this documentation page.
0 Kommentare
Aram Zeytunyan
am 23 Apr. 2024
2 Kommentare
Image Analyst
am 23 Apr. 2024
You said you have this line in your program:
addpath(genpath('C:\Users\username\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\moku-MATLAB(2)'))
remove that line.
Put that '-a' line on the mcc line, either on command line, or in a m-file script that you use to compile and possibly do other things (which is what I do), or use deploytool to use the -a option (which is what you're doing).
Steven Lord
am 24 Apr. 2024
Alternately, if you need to add this directory to your path when you're running your application in MATLAB (not as a deployed application), wrap it in:
if ~(ismcc || isdeployed)
end
as the documentation to which I linked showed you.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!