Use drop down menu to select file to plot

조회 수: 5 (최근 30일)
Konvictus177
Konvictus177 2021년 10월 17일
댓글: Konvictus177 2021년 10월 18일
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
Walter Roberson
Walter Roberson 2021년 10월 17일
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 2021년 10월 18일
Thanks for the help.
I was able to use listdlg box and bring the listdlg box up again when a certain condition was met.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by