How to asign the .m file selected from uigetfile() to the dropdown item permanently
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am creating an dynamic app where the user enters data to dropdown items and load all the corresponding files and folders to the working directory.
Initially the dropdown list was empty, When I press add button, I can enter the dropdown item name , the file and folder to be loaded to the current directory.
The newly added name will display in dropdown items. and the files/folders selected are loaded in the working direcory.
And the process continues like, the user can add n number of dropdown items and n number of files and folders to the directory.
My issue is when I add multiple dropdown items, the list will be displayed.
When I select any one dropdown item and press run button, the corresponding file loaded at the time of entering the name and loading folder to be run.
%% Global properties
properties (Access = public)
new % Description
end
%% Startup function
load("dropdown2.mat");
app.CalibrationModelDropDown.Items = dropdown;
%% Enter the new model and files/folders to the current working directory
app.new = app.EnterthemodelnameEditField.Value;
load("dropdown2.mat");
dropdown(:,end+1) = {app.new};
save("dropdown2.mat","dropdown","-append");
app.CalibrationModelDropDown.Items = dropdown;
%% Load file/ folder to the newly added dropdwon item
[file,path] = uigetfile('*.m','Choose file to save') ;
copyfile([path file],pwd)
app.EditField.Value = sprintf(file);
x = uigetdir();
[filepath,name,ext] = fileparts(x);
copyfile(x,convertStringsToChars(pwd + "\" + string(name)))
app.EditField_2.Value = fullfile(filepath);
%% Run button -- is asking again which file to be selected to run, I want the assigned model for the respective dropdown item to be run when i press run
[filename, pathname] = uigetfile('*.m', 'Pick a .m file');
run(fullfile(pathname,filename));
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!