how to add elements to listbox and retrieve(select) item from listbox

10 Ansichten (letzte 30 Tage)
COg
COg am 14 Dez. 2021
Bearbeitet: Cris LaPierre am 14 Dez. 2021
Hi,
i am trying to add multiple items once per time to a blank listbox and allowing them to display on the listbox and retrieve it to string( to command window or text area) at the end.
i have read some documents about how to do it, but i just cant find the right property to do it, what i have now is app.PlayList.setSelectedItems, it only allows me to add one item to the listbox, and if i want to add more, it gonna cover the previous one.
i havent figure this out yet, so i dont know how to do the retrieve.
I am new to Matlab and app designer, so if you dont mind please be precise.
thank you very much.

Antworten (1)

Cris LaPierre
Cris LaPierre am 14 Dez. 2021
Bearbeitet: Cris LaPierre am 14 Dez. 2021
You could use indexing to append a new value to the bottom of your listbox. Something like this should work (where newItem is a variable containing the text you want to add to your listbox.
app.PlayList.Items(end+1) = {newItem};
You can read more about the properties of a listbox here.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by