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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by