Bonjour,
Mon problème doit être assez proche de http://matlab.developpez.com/faq/?pa...radio_exclusif mais je ne comprend pas comment l'appliquer.
J'ai deux cases à cocher et je voudrais qu'en sélectionnant la première la seconde (voir 2,3 ou 4 autres check button) se décoche et inversement. Mon problème est que la valeur de ma seconde case n'est pas détecté dans la fonction callback...
Voici mon code :
La fonction checkbox_callback :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 handles.CheckBox_Patient = uicontrol(gcf, ... 'style', 'checkbox', ... 'position',[ 25 300 50 30 ],... 'BackgroundColor','white',... 'string','Tous',... 'Value',1,... 'tag','checkPatTous',... 'HorizontalAlignment','left'); set(handles.CheckBox_Patient, 'Callback', @checkbox_callback); set(findobj(handles.CheckBox_Patient, '-property', 'Units'), 'Units', 'normalized'); % CheckBox Type IMAGE handles.CheckBox_Pat_H = uicontrol(gcf, ... 'style', 'checkbox', ... 'position',[ 25 230 30 20 ],... 'BackgroundColor','white',... 'string','H',... 'Value',0,... 'tag','checkH',... 'HorizontalAlignment','left'); set(handles.CheckBox_Pat_H, 'Callback', @checkbox_callback); set(findobj(handles.CheckBox_Pat_H, '-property', 'Units'), 'Units', 'normalized'); checkbox_callback(handles.CheckBox_Pat_H , handles.CheckBox_Patient)
Et ce que me renvoie matlab :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 function checkbox_callback(composant1,composant2) get(composant1,'value') get(composant2,'value') % get(composant2,'Value') % if get(composant1,'Value')==1 % set (composant2,'Value',0) % end end
>>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 ans = 0 ans = 1 ans = [] ans = 0 ans = [] ans = 1 ans = []
Partager