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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| function gui_var_globales
global nCompteur handles
nCompteur=0;
nCompteur9=0;
% Création de l'objet Figure
handles(1)=figure('units','pixels',...
'position',[250 250 800 600],...
'color',[0.925 0.913 0.687],...
'numbertitle','off',...
'name','[GUI] Utilisation des variables globales',...
'menubar','none',...
'tag','interface');
% Création de l'objet Uicontrol VDC9
handles(2)=uicontrol('style','togglebutton',...
'units','normalized',...
'position',[0.1 0.5 0.2 0.1],...
'string','VDC9',...
'callback',@select1,...
'tag','VDC9');
handles(5)=uicontrol('style','pushbutton',...
'units','normalized',...
'position',[0.7 0.5 0.2 0.1],...
'string','STOP',...
'callback',@arret,...
'tag','STOP');
% Création de l'objet Uicontrol Text résultat
handles(6)=uicontrol('style','text',...
'units','normalized',...
'position',[0.35 0.55 0.2 0.05],...
'string','0',...
'tag','etat_9');
% Création de l'objet Uicontrol Text state
handles(7)=uicontrol('style','text',...
'units','normalized',...
'position',[0.35 0.5 0.2 0.05],...
'string','Min',...
'tag','state9');
end
function VDC9_Callback(hObject, eventdata, handles)
global nCompteur9 handles
val = get(hObject,'Value');
if button_state == get(hObject,'Max')
% Toggle button is pressed, take appropriate action
set(handles(7),'string',num2str(get(hObject,'Max')));
elseif button_state == get(hObject,'Min')
% Toggle button is not pressed, take appropriate action
set(handles(7),'string',num2str(get(hObject,'Min')));
end
set(handles(6),'string',num2str(nCompteur9));
end |
Partager