Bonjour,

Je vous propose un nouvel élément à utiliser : Création de présentation PowerPoint

Voici trois fonction qui permettent de facilement créer des présentation Power Point sous MATLAB. Le but étant de sortir ses résultats directement sous ppt pour faire par la suite une présentation.


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
function [h,presentation]=createPresentation(presentationTitle)
%% Open PowerPoint as a COM Automation server
h = actxserver('PowerPoint.Application')
 
%% ADD PRESENTATION
% View the methods that can be invoked
h.presentation.invoke
% Add a presentation via "Add" method
presentation = h.Presentation.Add
 
%% ADD SLIDES
% View the methods that can be invoked
presentation.Slides.invoke
% Add a slide via "Add" method
Slide1 = presentation.Slides.Add(1,'ppLayoutBlank')
Title1 = Slide1.Shapes.AddTextbox('msoTextOrientationHorizontal',200,200,400,70)
Title1.TextFrame.TextRange.Text = presentationTitle


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
function h=addFigure(h,Presentation,fig,slideNum,titleFigure)
 
%Presentation.Slides.invoke  %affiche les fonctions possibles
Slide = Presentation.Slides.Add(slideNum,'ppLayoutBlank')
 
figure(fig)
print('-dpng','-r150','C:\tmp.png')
 
%% ADD IMAGES TO SLIDES WITH TITLES
% Note: Change the image file full path names to where you save them
info = imfinfo('C:\tmp.png')
largeur=info.Width;
hauteur=info.Height;
if largeur>hauteur
    size=650;
    hauteur=size*hauteur/largeur
    largeur=size;
else
    size=500;
    largeur=size*largeur/hauteur
    hauteur=size;
end
Image = Slide.Shapes.AddPicture('C:\tmp.png','msoFalse','msoTrue',25,20,largeur,hauteur)
Title = Slide.Shapes.AddTextbox('msoTextOrientationHorizontal',200,10,400,70)
Title.TextFrame.TextRange.Text = titleFigure
delete('C:\tmp.png')

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
function closeAndSavePresentation(h,Presentation,fileName)
Presentation.SaveAs(fileName);
%% Close PowerPoint as a COM Automation server
h.Quit;
h.delete;

Ces trois fonctions s'utilisent de la manière suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
clear
slide=1; % slide de titre
[h,pres]=createPresentation('Presentation test');
figure(1)
plot(rand(1,100))
slide=slide+1;
h=addFigure(h,pres,1,slide,'TEST figure(1)')
figure(2)
plot(rand(1,500))
h=addFigure(h,pres,2,slide,'TEST figure(2)')
closeAndSavePresentation(h,pres,'C:\presentationTEST.ppt');
open('C:\presentationTEST.ppt')
---------------------------------
[Edit]
Ce tutoriel est inspiré de : Is there an example of using MATLAB to create PowerPoint slides?

Il fait suite à cette discussion : Créer un Powerpoint

Dut