If I change the folder names in the popup menu and i need to get the files in that folder to the list box and similar if i change to other folder , that folders files should come

조회 수: 1 (최근 30일)
  1. I am not clear how to change files in list box w.r.t that folder
Kindly please help me with this
Thanks
Lokesh

채택된 답변

Walter Roberson
Walter Roberson 2020년 7월 1일
ph = handles.YourPopup;
lh = handles.YourListbox;
selection_index = ph.Value;
if ~isempty(selection_index)
user_chosen_folder = ph.String{selection_index};
dinfo = dir(user_chosen_folder);
dinfo([dinfo.isfolder]) = []; %only want file names
filenames = {dinfo.name}; %names of the files
lh.String = filenames; %put the names in the listbox
drawnow()
end
  댓글 수: 4
KATARI LOKESH
KATARI LOKESH 2020년 7월 1일
Hi Rik,
I am very new to this, can you write a small example which two folders in popmenus and files in the list box.
Please help me with this
Thank you so much
Lokesh
Rik
Rik 2020년 7월 1일
Why don't you try the code that Walter gave you? If you don't understand a function, try reading the documentation. You asked what a specific variable meant, I explained it. If you don't understand the explanation, please say so, because giving you a code example will not help explaining what that value means.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by