フィルターのクリア

Varying numbers of toggle buttons in MATLAB guide

1 回表示 (過去 30 日間)
Brian Nguyen
Brian Nguyen 2021 年 10 月 5 日
回答済み: Walter Roberson 2021 年 10 月 5 日
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

回答 (1 件)

Walter Roberson
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.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by