Got error in compiling standalone app 2018a
29 ビュー (過去 30 日間)
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 件)
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 2020 年 1 月 4 日
You somewhere, either in
- your main m-file
- dependent m-files
- 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:
% It's not deployed. It's my development computer so I can cd to a folder on my drive
% It's the compiled, standalone executable.
% Don't change directory because they may not have that folder.
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.