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 天)
显示 更早的评论
- I am not clear how to change files in list box w.r.t that folder
Kindly please help me with this
Thanks
Lokesh
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!