How to create exe file from mlapp?

8 views (last 30 days)
Epri Pratiwi
Epri Pratiwi on 2 Dec 2022
Answered: Eric Delgado on 3 Dec 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"

Answers (1)

Eric Delgado
Eric Delgado on 3 Dec 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')

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!