現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
MATLAB standalone App not working when installed on another system
12 ビュー (過去 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 月 1 日
Thank You. Sure. I shall do this and attach the file as soon as possible.
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)