Got error in compiling standalone app 2018a

41 ビュー (過去 30 日間)
JFz
JFz 2018 年 5 月 17 日
回答済み: Image Analyst 2020 年 1 月 4 日
Hi,
I am compiling a simple matlab file and got this error:
Compiler version: 6.6 (R2018a)
Dependency analysis by REQUIREMENTS.
[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. ] Could not determine type of the MATLAB file 'runCost.m'. Please make sure that you are compiling MATLAB Program files.
What does the above mean? My file runCost.m is a Matlab Program file. Why is ti complaining?
Thanks for any input.
  2 件のコメント
JFz
JFz 2018 年 5 月 17 日
Thanks. It is a function.

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

回答 (2 件)

Jessie Bessel
Jessie Bessel 2020 年 1 月 4 日
Hello! Have you solve this error? I have the same error and i am trying to solve it. Can you help me?

Image Analyst
Image Analyst 2020 年 1 月 4 日
You somewhere, either in
  1. your main m-file
  2. dependent m-files
  3. your startup.m file
have a path hard-coded in. When you deploy this to some end-user's computer, it's possible/likely that they won't have that exact path on their computer and thus an error will get thrown when your code tries to use that path.
For example if you use cd in your startup.m file, that startup.m code gets run even on the end-user's computer. To prevent a cd to some folder that they don't have you could wrap it in isdeployed so that the code does not run on their computer:
if ~isdeployed
% It's not deployed. It's my development computer so I can cd to a folder on my drive
cd('c:/folder/on/myDrive');
else
% It's the compiled, standalone executable.
% Don't change directory because they may not have that folder.
end
However the warning is not smart enough to check if the path is, in fact, within an isdeployed so it will still warn you even if you did the above. I know for a fact because I have this exact situation.
Another situation might be if you referred to a file with a specific path, like
fileName = 'c:/my data/input data.xlsx';
data = xlsread(fileName);
It's warning you that your end user may not have input data.xlsx in that folder "C:/my data".
But if you know for a fact that you've handled hard-coded paths correctly, like use isdeployed or make sure you shipped and installed needed files in the folders where you expect to get them, then you can ignore the error. Otherwise correct the path or else your user will get an error.

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by