Find Index of Selected Drop Down in another variable (App Designer)

7 visualizaciones (últimos 30 días)
Brian
Brian el 4 de Ag. de 2024
Respondida: Walter Roberson el 5 de Ag. de 2024
Hello Matlab App Developer wizards.
Had a quick question. So I have this drop-down in a matlab app that calls a variable "Yield_raw(:,2)" to create a list. I want to know the index (i.e. row and column) of "Yield_raw" when this is selected. Any pointers? My code looks as follows:
Creates drop down
function ImportYieldFileButtonPushed(app, event)
[Yield_import, Yield_location] = uigetfile('*.xlsx', 'Select Yield File', '\\chlm2efs01\US_Share\');
Yield_raw = readtable([Yield_location, Yield_import]);
Yield_raw = table2cell(Yield_raw(:,[1,3:13]));
if exist('Yield_raw','var')
app.Lamp_Yield.Color ='g';
end
app.ProcessDropDown.Items = Yield_raw(:,2);
Selected drop down
function ProcessDropDownClicked(app, event)
% item = event.InteractionInformation.Item;
%%HOW DO I GET THE INDEX IN YIELD_RAW FOR THE VALUE I SELECTED IN THE DROP DOWN []
end

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Ag. de 2024
The default Value property of uilistbox is the index of the item selected. If, though, the ItemsData property is set, then the Value property returns the ItemsData entry corresponding to the selected entry.
The ValueIndex property always returns the index of the item selected.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by