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
| function guitest
fig=figure;
% Objet uicontrol style Listbox
uicontrol('style','listbox',...
'tag','listefichiers',...
'string',{'cape' 'clown' 'durer' 'earth' 'mandrill'},...
'units','normalized',...
'position',[0 0 .25 1],...
'callback',@affich)
% Objet Axes
axes('units','normalized',...
'position',[.3 .2 .6 .6],...
'visible','off',...
'tag','zoneaffich')
% Génération des identifiants des objets présents sur l'objet Figure
h=guihandles(fig);
% Ici h.<tag des objets> donc :
% h.listfichiers
% h.zoneaffich
% Sauvegarde de h pour usage ultérieur
guidata(fig,h);
function affich(obj,event)
% fonction de choix et d'affichage d'image
% Récupération de h
h=guidata(gcbf);
% Récupération du nom du fichier sélectionné
% Ici obj <=> h.listfichiers
val=get(obj,'value');
str=get(obj,'string');
% Chargement de l'image
% Chaque fichier contient deux variables : X et map
% Voir le tuto sur les images
load(str{val});
% Modification de la palette de couleur
colormap(map);
% Objet Axes zoneaffich courant
axes(h.zoneaffich)
% Affichage de l'image
imagesc(X);
% Mise au proportion de l'objet Axes
axis image |
Partager