How to create exe file from mlapp?

9 visualizaciones (últimos 30 días)
Epri Pratiwi
Epri Pratiwi el 2 de Dic. de 2022
Respondida: Eric Delgado el 3 de Dic. de 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"

Respuestas (1)

Eric Delgado
Eric Delgado el 3 de Dic. de 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')

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by