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

4 views (last 30 days)
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

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!