Compiled version not working because of path
Show older comments
Hello,
I have compiled similar programs successfully with earlier versions (e.g. 2017a), but now in 2019b have this issue.
Get this message in testing the software:

Here is the code that may be a problem. I also use the utility uipickfiles() from file exchange. Never use "addpath" itself. How do you find files if not like this?
% Plot the logo
[~,lingo] = dos('set username');
login = lingo(10:end-1);
% Plot the background and the logo: Background on axes2, logo on axes3
dir_name = ['C:\Users\',login,'\Desktop'];
wiggle_file_name = [dir_name,'\wiggles3.jpg'];
if exist(wiggle_file_name,'file')
imshow(wiggle_file_name);
end
logo_file_name = [dir_name,'\ctrl_v_logo.jpg'];
% imshow(logo_file_name); % Overwrites axes2
imshow(logo_file_name,'Parent',handles.axes3);
Any thoughts? This part is just to put a logo on the screen to start the program -- used to work! I'm not sure if the error occurs elsewhere, though.
I advise the user to put the installer on the Desktop as well as these figures.
Accepted Answer
More Answers (2)
Walter Roberson
on 25 Jan 2020
0 votes
You need to modify your startup.m so that it does not add anything to the search path if isdeployed() is true.
4 Comments
Douglas Anderson
on 25 Jan 2020
Edited: Douglas Anderson
on 25 Jan 2020
Stephen23
on 25 Jan 2020
Walter Roberson
on 25 Jan 2020
startup.m gets called automatically when MATLAB is started, provided it can find one in the path at the appropriate location.
Because MATLAB assumes that startup.m is setting important local customizations that are going to be needed by the MATLAB code, then MATLAB Compiler automatically looks for startup.m and incorporates it as part of the executable, to be run before the function that you designate as the entry point.
Image Analyst
on 26 Jan 2020
However even if you place the cd() or addpath() command in the "if ~isdeployed" block, it will still warn you -- I know from experience. In that case, just ignore the warning.
Douglas Anderson
on 26 Jan 2020
0 votes
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!