How can I get the index of the selected item in a pop-up menu within a uitable?
Ältere Kommentare anzeigen
I have set up a column as pop-up menu in my uitable as follows:
f=figure;
choices={'A' 'B' 'C' 'A'};
t=uitable(f,'ColumnFormat',{choices}, 'Data', {'';'';''} ,'ColumnEditable',[true]);
I would need to know the index of the selected item within my array choices in uitable's CellEditCallback. I.e., if the user selects 'C' from the menu, the index would be 3. The array of choices can have duplicate values, so I cannot simply use strcmp to match the selected value.
J.
Antworten (2)
Sean de Wolski
am 21 Aug. 2012
Well written question
f=figure;
choices={'A' 'B' 'C' 'A'};
t=uitable(f,'ColumnFormat',{choices}, 'Data', {'';'';''} ,'ColumnEditable',[true],'celleditcallback',@(src,evt)disp(evt));
This should make it pretty clear.
1 Kommentar
J. Jotakin
am 21 Aug. 2012
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!