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
| function exemple_main
%EXEMPLE_MAIN Exemple d'une interface graphique codée à la main
% Création de l'objet Figure
fig = figure('units', 'pixels', ...
'position', [520 380 300 200], ...
'name', 'example_main');
% Création de l'objet Uicontrol Pushbutton
uicontrol('style', 'pushbutton', ...
'units', 'pixels', ...
'position',[75 10 150 20], ...
'callback', @cb);
% Création de l'objet Axes
axes('units', 'pixels', ...
'position', [25 40 250 150], ...
'tag','axes1');
% Stockage des identifiants utiles
handles = guihandles(fig);
guidata(fig,handles)
function cb(obj,event)
% Fonction associée au Callback de l'objet Pushbutton
% obj : identifiant de l'objet Pushbutton
% event : événement liés à l'objet Pushbutton
% Récupération des identifiants utiles
fig = get(obj,'parent');
handles = guidata(fig);
% Modification de la couleur de l'objet Axes
[x,y]=ginput(2) |
Partager