2 popup menus connected

1 view (last 30 days)
Dinouk Goonewardena
Dinouk Goonewardena on 31 Mar 2020
Commented: Rik on 1 Apr 2020
I'm trying to create 2 popup menus the first one stores all the 'Y numbers' and then depending on that I want to get the corressponding 'Version'. Note some Y numbers have more than 1 version. Hence I need help to figure it out
  10 Comments
Dinouk Goonewardena
Dinouk Goonewardena on 31 Mar 2020
Edited: Dinouk Goonewardena on 31 Mar 2020
A better example of data i guess, So the first 2 Y number (1) has 2 versions, which should be in the popupmenu2

Sign in to comment.

Answers (1)

Rik
Rik on 31 Mar 2020
Ynumber=[1;1;2;3;5];
Version={'AP'; 'AP_R' ;'AP' ;'TI1' ;'TI2'};
mytable= table(Ynumber,Version);
%Y_selected=get(handles.dropdown_Y,'Value');
Y_selected=2;
selected_Ynumber=mytable.Ynumber(Y_selected);
L=ismember(mytable.Ynumber,selected_Ynumber);
versions=mytable.Version(L);
The last variable can be used as the String property of your second dropdown.
  4 Comments
Rik
Rik on 1 Apr 2020
The code I posted works. You can't send me the data you're working with, so you will have to provide example data that will reproduce the error. It seems like Y_selected might not be a scalar, or data_sheet2 is not a table or scalar struct.

Sign in to comment.

Categories

Find more on Entering Commands in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by