이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
MATLAB standalone App not working when installed on another system
조회 수: 11 (최근 30일)
이전 댓글 표시
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.
채택된 답변
Image Analyst
2023년 8월 27일
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
NAVNEET NAYAN
2023년 8월 27일
% 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
2023년 8월 27일
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
2023년 8월 27일
I got an error message while using your code. Please find the attached screenshot.
Image Analyst
2023년 8월 27일
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
2023년 8월 27일
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
2023년 8월 27일
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
2023년 8월 27일
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
2023년 8월 28일
Thanks a lot for all your efforts and time but I am still facing the same issue of path.
Image Analyst
2023년 8월 28일
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
2023년 9월 1일
@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
2023년 9월 1일
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
2023년 9월 4일
편집: NAVNEET NAYAN
2023년 9월 5일
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
2023년 9월 11일
@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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)