Filter löschen
Filter löschen

How to save checkbox values in an array?

8 Ansichten (letzte 30 Tage)
Marlon Saveri Silva
Marlon Saveri Silva am 14 Aug. 2015
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

Akzeptierte Antwort

Marlon Saveri Silva
Marlon Saveri Silva am 18 Aug. 2015
Bearbeitet: Marlon Saveri Silva am 18 Aug. 2015
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.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by