フィルターのクリア

How to set a buttons from their panel

2 ビュー (過去 30 日間)
Nimrodb
Nimrodb 2013 年 2 月 27 日
I have a Panel with several checkbox buttons. I want to read their value and change their setting.
ButtonsValue = get(get(handles.Panel,'Children'),'Value')
for eg.:
ButtonsValue =
[1]
[1]
[0]
Now I want to reload this value:
ButtonsHandle = get(handles.Panel,'Children');
set(ButtonsHandle,'Value',ButtonsValue)
That gives back an error:
Error using set
Conversion to double from cell is not possible.

採用された回答

Jan
Jan 2013 年 2 月 28 日
編集済み: Jan 2013 年 2 月 28 日
If set gets a list of handles as input, the value of the property can be a cell also, if the name or the property is provided as cell also:
ButtonValue = {0, 1, 0}; % Or perhaps {0;1;0}
ButtonsHandle = get(handles.Panel, 'Children');
set(ButtonsHandle, {'Value'}, ButtonsValue);
See doc set -> Setting Different Values for the Same Property on Multiple Objects
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 28 日
It works for {0;1;0}

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by