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

12 ビュー (過去 30 日間)
Brian
Brian 2024 年 8 月 4 日
回答済み: Walter Roberson 2024 年 8 月 5 日
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

回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 8 月 5 日
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.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by