Populate one pop up menu on the basis of selection in another pop up menu.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello
I have two popup menus. popup menu1 : Directory and popup menu2: File names. In pop up menu 1 directory names should appear and in popup menu 2 Files in that directory should appear.
However, when I click any of the directory names in popup menu 1 then only the file names in first directory are being displayed. Please help me.
for i = 1 : size(dirinfo,1)
%Reading names of People
People(i).Name = dirinfo(i,1).name;
text{i}= People(i).Name;
%Reading files of all people in structure format
cd(Functions_Dir)
People(i).Image_Name = ReadFileNames([Home_Dir '\Inputs\' dirinfo(i,1).name]);
text1{i}= People(i).Image_Name ;
cd ..
end
set(handles.popupmenu1,'string',text);
a=get(handles.popupmenu1,'value');
switch a
case 1
tex= text1{1};
case 2
tex= text1{2};
end
set(handles.popupmenu2,'string',tex);
0 Commenti
Risposte (1)
ES
il 22 Mar 2017
In call back of popupmenu1 you should write this..
a=get(handles.popupmenu1,'value');
switch a
case 1
tex= text1{1};
case 2
tex= text1{2};
end
set(handles.popupmenu2,'string',tex);
is this done? I am not able to see the functions in your code. That is why I am clarifying.
7 Commenti
Jan
il 22 Mar 2017
@Sidra: It is not easy to guess, what exactly "the first directory" is. Remember that I do not have the faintest idea about what you are doing.
I assume the problem appears at the location, where you define, what the "first" and "second" directory is. Where does this happen?
Do you know how to step through the code using the debugger?
Vedere anche
Categorie
Scopri di più su File Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!