Varying numbers of toggle buttons in MATLAB guide

2 vues (au cours des 30 derniers jours)
Brian Nguyen
Brian Nguyen le 5 Oct 2021
Hello!
So I have a list of sentences with varying numbers of words in which I can count the amount of words there are. From my GUI, I want to display each sentence and associate the words with a toggle button. For example, if the sentence said "hello world", there will be two toggle buttons that will have "hello" and "World" respectively. Furthermore, I am using GUIDE to make my GUI. Is there any tips/functions that can help point me in the right direction? I think uicontrol() can create toggle buttons, but I am unsure how it would work with GUIDE.
Thanks

Réponses (1)

Walter Roberson
Walter Roberson le 5 Oct 2021
Yes, with "traditional figures" such are used with GUIDE, you would call uicontrol() to create new toggle buttons. You would associate each with a Position, and you would set the Callback property of each one.
You will probably find it easier from a design perspective to create a uipanel() and parent the uicontrol to the uipanel.
If you expect you might have more than a small number of these, then you might want to think about making the uipanel scrollable. That is a bit clumsy in GUIDE but can be done (the trick is to create two uipanel and have a scrollbar in the outer panel that is controlling the Position of the inner panel; the outer panel acts like a "frame" to mask the inner panel.)
Remember that your words might be different lengths, so you have to do some planning about how to position the buttons.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by