App Designer Drop-Down ItemsData
    24 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Alex Savic
 am 19 Dez. 2021
  
    
    
    
    
    Beantwortet: Shanmukha Voggu
    
 am 28 Dez. 2021
            I have a drop down list with 5 items and I want to associate each item to have a cell of 2 values (a density and a bulk modulus). How can I write this code such that MATLAB does not treat them as characters. Additionally, how can I then access these two numbers separatley in a callback function?
0 Kommentare
Akzeptierte Antwort
  Shanmukha Voggu
    
 am 28 Dez. 2021
        Hi Alex,
I understood you want to map every item of drop down to a cell of 2 values (Density and BulkModulus)
you can achieve this by following code
app.DropDown.Items={'Item-1','Item-2','Item-3','Item-4','Item-5'};
app.DropDown.ItemsData={{1,2},{3,4},{5,6},{7,8},{9,10}};
Accessing the current value of dropdown can be done as follows
value = app.DropDown.Value;
density = value{1};
bulkModulus = value{2};
Accessing the whole data for every item in the dropdown can be done as follows
dataArray = app.DropDown.ItemsData  % cell array that contains each value associated with corresponding item in drop down
I have attached the app that demonstrates the same.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

