Borrar filtros
Borrar filtros

How to save checkbox values in an array?

8 visualizaciones (últimos 30 días)
Marlon Saveri Silva
Marlon Saveri Silva el 14 de Ag. de 2015
Editada: Marlon Saveri Silva el 18 de Ag. de 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

Respuesta aceptada

Marlon Saveri Silva
Marlon Saveri Silva el 18 de Ag. de 2015
Editada: Marlon Saveri Silva el 18 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by