Varying numbers of toggle buttons in MATLAB guide
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Walter Roberson
2021-10-5
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!