Use drop down menu to select file to plot

3 Ansichten (letzte 30 Tage)
Konvictus177
Konvictus177 am 17 Okt. 2021
Kommentiert: Konvictus177 am 18 Okt. 2021
Hi,
I have multiple .mat files in my folder that I load into matlab using dirfiles. How can I have a drop down menu or list that lets me select which file I want to plot and switch from one file to the other one?
for k = 1:numfiles
myfilename = dirfiles(k).name;
fullFileName = fullfile(PathName, myfilename);
mydata{k} = load(fullFileName);
end
  5 Kommentare
Walter Roberson
Walter Roberson am 17 Okt. 2021
filenames = {dirfiles.name};
[indx, tf] = listdlg('ListString', filenames, 'PromptString', 'Select a file');
if ~tf; return; end %user cancel
fullFileName = fullfile(PathName, filenames{indx});
mydata = load(fullFileName);
Konvictus177
Konvictus177 am 18 Okt. 2021
Thanks for the help.
I was able to use listdlg box and bring the listdlg box up again when a certain condition was met.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by