How to create exe file from mlapp?

15 ビュー (過去 30 日間)
Epri Pratiwi
Epri Pratiwi 2022 年 12 月 2 日
回答済み: Eric Delgado 2022 年 12 月 3 日
I have some questions?
My GUI is running by reading wav files from "ChildrenSong" and images from "images".
  1. How to add files inside folder? I seem like only add the folder, with any file inside in "Files required for your application to run".
  2. What I should put on "Files installed for your end user"

回答 (1 件)

Eric Delgado
Eric Delgado 2022 年 12 月 3 日
Are you going to allow the users of your app to add new songs or new images? If so, put those folders in "Files installed for your end user". But if you are not going to allowed this kind of operation and you want to "hide" it, put those folders in "Files required for your application to run". Don't forget to use fullfile to point correctly to your files.
% If you choose "Files installed for your end user" as your solution:
% (1) Create a property named "RootFolder"
% (2) Put the code below in the startup of your app
appName = "NameOfYourApp";
if isdeployed
[~, result] = system('path');
app.RootFolder = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
else
prjPath = matlab.project.rootProject;
appPath = fullfile(char(com.mathworks.appmanagement.MlappinstallUtil.getAppInstallationFolder), appName);
if ~isempty(prjPath) & strcmp(prjPath.Name, appName)
app.RootFolder = char(prjPath.RootFolder);
elseif isfolder(appPath)
app.RootFolder = appPath;
else
error('path of the app...')
end
end
% If you choose "Files required for your application to run" as your solution:
% (1) Create a property named "RootFolder"
% (2) Put the code below in the startup of your app
appName = "NameOfYourApp";
if isdeployed
app.RootFolder = fullfile(ctfroot, appName);
else
prjPath = matlab.project.rootProject;
appPath = fullfile(char(com.mathworks.appmanagement.MlappinstallUtil.getAppInstallationFolder), appName);
if ~isempty(prjPath) & strcmp(prjPath.Name, appName)
app.RootFolder = char(prjPath.RootFolder);
elseif isfolder(appPath)
app.RootFolder = appPath;
else
error('path of the app...')
end
end
% And...
fullfile(app.RootFolder, 'ChildrenSong', 'NameOfTheSong.mp3')
fullfile(app.RootFolder, 'images', 'NameOfTheImage.jpeg')

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by