Why does creating a standalone application generate a warning regarding "startup.m" adding paths?

71 ビュー (過去 30 日間)
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.

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 5 月 10 日
編集済み: MathWorks Support Team 2021 年 5 月 10 日
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 件のコメント
Bruno Luong
Bruno Luong 2022 年 7 月 6 日
"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

サインインしてコメントする。

その他の回答 (2 件)

Jessie Bessel
Jessie Bessel 2020 年 1 月 4 日
編集済み: Jessie Bessel 2020 年 1 月 4 日
Hello! Did you solve the error? I have the same error and I can not figure it out! Can you help me?
  2 件のコメント
Nataraj
Nataraj 2022 年 7 月 6 日
Type which startup.m -all in your command window. If you find the file then delete it from the path. Then perform the build process again. It might work.

サインインしてコメントする。


Bruno Luong
Bruno Luong 2022 年 7 月 6 日
編集済み: Bruno Luong 2022 年 7 月 6 日
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.

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by