lundi 16 janvier 2017

How to know which checkbox is selected?

I have 2 checkbox. The tags are 'car' and 'bycycle'. They have strings declared as 'check1' and 'check2'.

When the button pressed, I want to know which checkbox is checked.

I only know this way:

function pushbutton3_Callback(hObject, eventdata, handles)
clc;
car = get(handles.car,'Value')
bycycle = get(handles.bycycle,'Value')

if car==1
..

elseif bycycle ==1
..

But i want to know if there's another way without the get(handles.sometags,'Value'), because with that approach I have to mannually declare handles.car, handles.bycycle, etc..




Aucun commentaire:

Enregistrer un commentaire