Bonjour,

Je sais qu'il y à beaucoup de postes sur comment enregistrer une une figure sur Matlab mais si j'ouvre cette discussion c'est parce que je n'ai pas trouvé de réponse à ma question.

Bref, voici une version simplifiée de mon code:

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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
function programe
clear all;
close all;
hFig=figure('units','normalized','outerposition',[0 0.05 1 0.95],'Name','Dépouillement','NumberTitle','off','toolbar','figure');

hTabGroup = uitabgroup('Parent', hFig);

hTabs(1) = uitab('Parent', hTabGroup, 'Title', 'Paramètres');
hTabs(2) = uitab('Parent', hTabGroup, 'Title', 'Dépouillement');
hTabs(3) = uitab('Parent', hTabGroup, 'Title', 'Comparaison');
hTabs(4) = uitab('Parent', hTabGroup, 'Title', 'Masse injectée');
hTabs(5) = uitab('Parent', hTabGroup, 'Title', 'Delta P');
hTabs(6) = uitab('Parent', hTabGroup, 'Title', 'Coef comp');
hTabs(7) = uitab('Parent', hTabGroup, 'Title', 'Fuites');
hTabs(8) = uitab('Parent', hTabGroup, 'Title', 'Convergence');
hTabs(9) = uitab('Parent', hTabGroup, 'Title', 'Modèle en construction');

%set(hTabGroup, 'SelectedTab', hTabs(1));
firstPanel = uipanel('Title', 'Informations Principales', 'Parent', hTabs(1));
secondPanel = uipanel('Title', 'Traitement d''un seul fichier de mesure', 'Parent', hTabs(2));
thirdPanel= uipanel('Title', 'Comparaison de plusieurs fichiers de mesures', 'Parent', hTabs(3));
fourthPanel= uipanel('Title', 'Cartographie de masse injectée', 'Parent', hTabs(4));
fifthPanel= uipanel('Title', 'Cartographie de delta prail', 'Parent', hTabs(5));
sixthPanel= uipanel('Title', 'Cartographie des coefficients de compressibilité du carburant', 'Parent', hTabs(6));
seventhPanel= uipanel('Title', 'Cartographie des fuites statiques et dynamiques injecteur', 'Parent', hTabs(7));
eighthPanel= uipanel('Title', 'Convergence des mesures', 'Parent', hTabs(8));
ninthPanel= uipanel('Title', 'Modèle en construction', 'Parent', hTabs(9));

main_0(firstPanel);
main_1(secondPanel);
main_2(thirdPanel);
main_3(fourthPanel);
main_4(fifthPanel);
main_5(sixthPanel);
main_7(seventhPanel);
main_6(eighthPanel);
main_8(ninthPanel);
end

function main_0(parent)
%Fenêtre expliquant les fonctionnement du programme
instruction={'Ce programme fonctionne de la manière suivante:' '' '1- Entrez le chemin du dossier comprenant les fichiers à dépouiller.' '2- Si vous souhaitez comparer plusieurs fichiers, entrez un à un le chemin des dossier comprenant les fichiers à comparer.'};
 uicontrol('Parent',parent,'style','text','units','normalized',...
    'String',instruction,...
    'HorizontalAlignment','left','position',[0.025 0.85 0.8 0.1],'FontSize',11);
end

%% Onglet Dépouillement
function main_1(parent)


%Définition de la position du graph
axes('Parent',parent,'Units','normalized','position',[0.25 0.1 0.69 0.82],'Tag','Onglet_1');

plot(magic(5))

end

function main_2(parent)


%Définition de la position du graph
axes('Parent',parent,'Units','normalized','position',[0.5 0.1 0.4 0.82],'Tag','Onglet_2');

x=rand(5,1);
y1=rand(5,1);
y2=rand(5,1);
y3=rand(5,1);
plotyy(x,y1,x,y2)
hold on
plot(x,y3)

uicontrol('Parent',parent, ...  
  'Style', 'pushbutton', ... 
  'String', 'save', ... 
  'Units','normalized','Position', [0.01 0.01 0.04 0.04], ...
  'Callback', @save);  

    function save (src,evt)
        hChild = allchild(gca);
        ftmp = figure('units','normalized','outerposition',[0 0.05 1 0.95]);
        toto=axes;
        copyobj(hChild, toto);
        pause(1)
        saveas(ftmp, 'Enregistrement','emf');
        delete(ftmp);
    end
end

Je souhaite créé deux fonctions, qui seront les "callback" de deux "push button" une qui permettrait d'enregistrer seulement le graphique de l'onglet sélectionné (essai en rouge) et une autre fonction (non programmée) qui enregistrerais tout l'onglet (comme une impression écran de l'onglet).

Merci d'avance de votre aide.