How to create exe file from mlapp?

10 visualizzazioni (ultimi 30 giorni)
Epri Pratiwi
Epri Pratiwi il 2 Dic 2022
Risposto: Eric Delgado il 3 Dic 2022
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"

Risposte (1)

Eric Delgado
Eric Delgado il 3 Dic 2022
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')

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by