Borrar filtros
Borrar filtros

How to Point to the path and files when loading Running App

6 visualizaciones (últimos 30 días)
Weiwei Luo
Weiwei Luo el 19 de Nov. de 2021
Comentada: Weiwei Luo el 23 de Nov. de 2021
I design an app to load a pre-train deep learning model to do image segmentation. The pretrained model is placed in a folder and included during packaging the app. My wish is to automatically load the model. However, it doesn't seen to be the way. The following is my starup function of the app.
I have two folders, v5_function and v5_model. During the packaging, these two folders are added in. And then after the installation of the app, I can find them in the following folder:
C:\Users\[user name]\AppData\Roaming\MathWorks\MATLAB Add-Ons\Apps\OCTv5\
I want the app to automatically include the functions in v5_function, which there is no issue; then load the model files from the v5_folder. However, isempty(app.model_file) is always 1.
Can anyone tell me what is wrong with the line
app.model_file = dir('.\v5_model\model*.mat');
and is the addpath(genpath(... )) used in the right way?
function startupFcn(app)
addpath(genpath('.\v5_function'));
app.model_file = dir('.\v5_model\model*.mat');
while isempty(app.model_file)
msgbox('No DL model file. Please specify model file folder.');
start_path=pwd;
inputfolder_name = uigetdir(start_path);
app.model_file = dir([inputfolder_name, filesep, 'model*.mat']);
end
% Other initialization code
....
end
  2 comentarios
Weiwei Luo
Weiwei Luo el 23 de Nov. de 2021
Thank you Geoff! The following line helps!
absPath = fileparts(mfilename('fullpath')); % absolute path to the folder containing the mlapp file

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by