You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
MATLAB standalone App not working when installed on another system
15 views (last 30 days)
Show older comments
I designed a MATLAB App using MATLAB App Designer. My app plays videos corresponding to the given words. It works fine. Next, using MATLAB compiler I developed .exe file of my app. Using this .exe file I installed the app on different system. On this system, my app window opens but when I give words as input I don't get any video. I simply get blank GUI window of my app. Can anyone suggest some way out? Feel free to comment.
Accepted Answer
Image Analyst
on 27 Aug 2023
See the FAQ for a list of common reasons your compiled app won't run on a target system:
Most likely it's a path problem where you are either not deploying the videos to the target system, or you are not specifying the full path name correctly in the code (like you're just assuming the videos should be in the current folder).
15 Comments
NAVNEET NAYAN
on 27 Aug 2023
% Button pushed function: PlayButton
function PlayButtonPushed(app, event)
alph = app.InputDataEditField.Value;
Folder = 'F:\test_vids';
% Folder = pwd;
for k=1:length(alph)
aFile = fullfile(Folder, alph(k) + ".avi");
videoFReader = VideoReader(aFile);
n=videoFReader.NumberOfFrames;
for m=1:n
frames=read(videoFReader,m);
imshow(frames, 'Parent', app.UIAxes);
end
end
end
This is how I am reading my video files. Using Folder = pwd, also didn't solve my issue.
Should there be the video files (that are to be played after giving input) deployed on the target system? While packaging I have included the video files along with code in MATLAB compiler.
I have visited the link provided by you but couldn't sort out my issues.
Image Analyst
on 27 Aug 2023
Add this:
aFile = fullfile(Folder, alph(k) + ".avi");
if ~isfile(aFile)
warningMessage = sprintf('Warning: file not found. Please check path.\n"%s"', aFile)
uiwait(warndlg(warningMessage));
% Pop open that folder in File Explorer if using Windows
if ispc
winopen(Folder);
end
break;
end
NAVNEET NAYAN
on 27 Aug 2023
I got an error message while using your code. Please find the attached screenshot.
Image Analyst
on 27 Aug 2023
That doesn't make sense. If you put that code inside the for loop, then break is certainly 100% allowed. I think you didn't have it inside your for loop. But regardless, you can replace it with return as well, which will get out of the function. Or you can replace it with "continue" which will not exit the for loop but try to read in the next video.
NAVNEET NAYAN
on 27 Aug 2023
Yes, I corrected it there was a mistake. Now I got an error stating Warning: file not found. Please check path. How can we give path on target system? Do we need to deploy videos on target system? If yes, then it is problematic for a general use purpose.
NAVNEET NAYAN
on 27 Aug 2023
Can you please suggest me some ways to develop a link between path of videos to be played and the app installed on the target system?
Image Analyst
on 27 Aug 2023
What kind of variable is alph? Isn't it just a string that the user type in? So you don't want to loop over every character in the filename with a for loop. That doesn't make sense. You just want to take the name and build the filename from it and loop over the individual frames ONLY. Here is much more robust code:
% Button pushed function: PlayButton
function PlayButtonPushed(app, event)
% Get base file name from edit field.
baseFileName = app.InputDataEditField.Value;
% Specify a folder in a fixed location.
folder = 'F:\test_vids';
% Folder = pwd;
% See if the folder exists.
if ~isfolder(folder)
warningMessage = sprintf('Warning: folder not found. Please check path.\n"%s"', folder)
uiwait(warndlg(warningMessage));
% Pop open that folder in File Explorer if using Windows
if ispc
winopen(folder);
end
return;
end
% If it gets here the folder is good.
% Build the filename from what the user typed in in the edit field.
fullFileName = fullfile(folder, baseFileName);
% See if the user specified an extension.
[f, baseFilenameNoExt, ext] = fileparts(baseFileName);
% If they did not specify an extension, tack on .avi.
if isempty(ext)
fullFileName = fullfile(folder, [baseFilenameNoExt, '.avi']);
end
% See if the avi file actually exists.
if ~isfile(fullFileName)
warningMessage = sprintf('Warning: file not found. Please check path.\n"%s"', fullFileName)
uiwait(warndlg(warningMessage));
% Pop open that folder in File Explorer if using Windows
if ispc
winopen(Folder);
end
return;
end
% If it gets to here both the folder and AVI file exist. So read it in.
videoFReader = VideoReader(fullFileName);
numFrames = videoFReader.NumberOfFrames;
for m = 1 : numFrames
thisFrame = read(videoFReader,m);
imshow(thisFrame, 'Parent', app.UIAxes);
drawnow; % Make sure axes updates immediately.
end
end
However, even this is not great. You should not force users to type in a filename. You should have a listbox where you call dir and load up the listbox with the filenames so they can simply click a filename in the listbox.
NAVNEET NAYAN
on 28 Aug 2023
Thanks a lot for all your efforts and time but I am still facing the same issue of path.
Image Analyst
on 28 Aug 2023
Upload your lastest .mlapp file along with any files it needs to launch (splash images, .mat files, etc.) and I'll run it and fix it.
NAVNEET NAYAN
on 1 Sep 2023
@Image Analyst Sorry for being so late in replying. Please find attached the latest .mlapp file and videos of 4 alphabets and one word as an example to run the app. The only thing is I am not able to upload is .mp4 or .avi file. So, I converted these files into .gif format. For running the app, you need to convert these .gif files to .mp4 files.
Please let me know if you require anything else.
Image Analyst
on 1 Sep 2023
Try zipping them up and attaching. I'm traveling the next 6 days without MATLAB so I won't be able to try anything for about a week.
NAVNEET NAYAN
on 1 Sep 2023
Thank You. Sure. I shall do this and attach the file as soon as possible.
NAVNEET NAYAN
on 4 Sep 2023
Edited: NAVNEET NAYAN
on 5 Sep 2023
Here, I have attached the .zip file that contains the .mlapp files and .mp4 files of few alphabets and words. My target is to display videos of alphabets, combination of alphabets (with space and without space) and words and run this app as a standalone app on a different system.
NAVNEET NAYAN
on 11 Sep 2023
@Image Analyst Did you get some time to look into the problem? I kept on trying to find a way but I couldn't find a solution.
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing 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!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)