フィルターのクリア

How to save checkbox values in an array?

8 ビュー (過去 30 日間)
Marlon Saveri Silva
Marlon Saveri Silva 2015 年 8 月 14 日
編集済み: Marlon Saveri Silva 2015 年 8 月 18 日
Hi, this is the first time I use an userform at Matlab
I introduced there some checkboxes and I would like to save their values in an array at my code, something like:
Myarray = [checkbox1.value, checkbox2.value, ..., checkbox30.value]
It seems to be very simple, but I can't find an answer at internet :/
I'm using Matlab 2011

採用された回答

Marlon Saveri Silva
Marlon Saveri Silva 2015 年 8 月 18 日
編集済み: Marlon Saveri Silva 2015 年 8 月 18 日
Hi,
I've gotten a solution:
function checkbox1_Callback(hObject, eventdata, handles)
CheckBoxValue=get(handles.checkbox1,'Value');
if isequal(CheckBoxValue,1)
evalin('base', 'MyArray(1)=1;'); %Save "TRUE" in the array "MyArray()"
else
evalin('base', 'MyArray(1)=0;');
end
Then... I've just repet it for each checkbox. It's very strange MATLAB saves GUI variables in another workspace, when I couldn't get access.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by