Got error in compiling standalone app 2018a

11 次查看(过去 30 天)
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 个)

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.

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by