Is it possible give a different value to the checkbox?

1 回表示 (過去 30 日間)
Antonino Alesci
Antonino Alesci 2016 年 4 月 26 日
コメント済み: Antonino Alesci 2016 年 4 月 26 日
I want give a value to the checkbox, for example 20.
set(handles.checkbox1,'Value',20), in this way the code is it correct?

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 26 日
Yes, that is correct. However if you want the checkbox to render, then the Value you assign needs to be equal to either the Min or Max property that you have configured. You can configure the Min and Max properties to any numeric values. When the checkbox is ticked, the value configured for Max will be returned; when the checkbox is not ticked, the value configured for Min will be returned. For example
set(handles.checkbox1, 'Min', -3.141, 'Max', 20, 'Value', 20)
Then get(handles.checkbox1, 'Value') will return either -3.141 or 20

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by