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

12 vues (au cours des 30 derniers jours)
COg
COg le 14 Déc 2021
Modifié(e) : Cris LaPierre le 14 Déc 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.

Réponses (1)

Cris LaPierre
Cris LaPierre le 14 Déc 2021
Modifié(e) : Cris LaPierre le 14 Déc 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.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by