Why does creating a standalone application generate a warning regarding "startup.m" adding paths?
77 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 23 Okt. 2017
Bearbeitet: Bruno Luong
am 6 Jul. 2022
Why does creating a standalone application in MATLAB R2017a or later generate the folllowing warning regarding "startup.m" adding paths?
ERROR: Warning: Your deployed application may error out because file or folder paths
not present in the deployed environment may be included in your MATLAB startup
file. Use the MATLAB function "isdeployed" in your MATLAB startup file to
determine the appropriate execution environment when including file and folder
paths, and recompile your application.
Akzeptierte Antwort
MathWorks Support Team
am 10 Mai 2021
Bearbeitet: MathWorks Support Team
am 10 Mai 2021
The warning message was introduced in R2017a and is intended to let the customers know that having a user-defined startup script for MATLAB ("startup.m" ) may cause errors in the deployment environment. It also recommends using "isdeployed" function to determine the current execution environment.
Note that getting this warning does not necessarily mean that the "startup.m" file(s) have any code that is changing or adding paths. The warning is emitted if any "startup.m" is present on the MATLAB path.
Workarounds:
1. Inspect the "startup.m" files present in your installation:
>> which startup.m -all
If the content present in the "startup.m" files is irrelevant to your compiled application, you can simply ignore the warning.
To suppress the warning, you would need to either rename or remove the "startup.m" file(s) from the MATLAB path. However, note that this may cause issues with your local MATLAB environment, depending on the purpose of those "startup.m" file(s).
2. When you add files using the -a flag that do not appear on the MATLAB path at the time of compilation, a path entry is added to the application's run-time path so that they appear on the path when the deployed code executes. If you use the -a flag to include a file that is not on the MATLAB path, the folder containing the file is added to the MATLAB dependency analysis path. As a result, the dependency analyzer is able to find 'startup.m' file and hence gives the warning message.
As a workaround, make sure that the files you are adding using -a flag are not in the same folder where 'startup.m' file is present.
1 Kommentar
Bruno Luong
am 6 Jul. 2022
"When you add files using the -a flag ...As a result, the dependency analyzer is able to find 'startup.m' file and hence gives the warning message."
Sorry it doesn' make much sense to me. Why it is matter the dependency analyzer find startup and user added file that migh have nothing to do with startup?
This warning is too sensitive and unjustified, and thus anoying
Weitere Antworten (1)
Bruno Luong
am 6 Jul. 2022
Bearbeitet: Bruno Luong
am 6 Jul. 2022
Turn off the warning
warning('off','Compiler:compiler:COM_WARN_STARTUP_FILE_INCLUDED')
You might put it in your startup.m so that this anoying warning does appear anymore.
Don't delete you startup.m it's there for a reason.
It's just me but I think the startup should never be included in the compilation, at least we must have a switch option NOT to include it during the compilation.
0 Kommentare
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!