Manage powerpoint on Matlab

11 次查看(过去 30 天)
Hello,
Part of my job is now to create powerpoint with a lot of figure which "that is good ..." "that is not..". And all of the figure came from Matlab. I spent time to copy/paste one by one (and resizing since my Matlab figure are big). I searched how to automate this but I didn't find the keys.
Apparently, it involves the COM Auomation but I don't find documentation on it.
I found those things, which looked helpful but...
I tried to copy-past the saveppt code (my trash.m file), but I get an error (although the file exist) :
??? Invoke Error, Dispatch Exception: Le fichier spécifié est introuvable.
op = invoke(ppt.Presentations,'Open','validation_ppt.pptx',[],[],0);
in english : The specified file is missing.
I don't find any documentation on this. So I'm blocked.
If someone tells me : "Hey, here there is a pdf file on COM Automation server which explain how it works in Matlab." I would be happy.
(I don't really searched an answer on my present issue, since it will only be the first of the list. But how to get find documentation.)
EDIT : I linked the wrong file.
  2 个评论
Ortinomax
Ortinomax 2015-4-16
Thanks Sebastian Castro
One solution lead to another problem. So i'm stuck again. I tried to have my figure copied in the clipboard and then paste on the powerpoint.
ppt = actxserver('powerpoint.application');
myPres=ppt.Presentations.Open('D:\Perso\myppt.pptx');
slide3=myPres.Slides.Item(3); % slect the slide 3
myFIg=figure(); %create the figure to test
plot([0 1],[1 1],'m');
print('-dmeta',myFIg) % copy to clipboard
% past to the slide 3, and get the handles of the picture (useful to resize, move...)
pic(k)=slide3.Shapes.PasteSpecial().Item(1);
It works, and almost good. But when I do the same manually (Figure>Edit>Copy Figure then Powerpoint>Paste), the picture has transparency. It needs the transparency back.
I thought it could be done with optional argument of the PasteSpecial method. But I need to pass an PpPasteDataType argument, and everything I tried fail (Type Mismatch).
Any help would be appreciated.
Ashwini  More
Ashwini More 2020-2-3
Hi,
I am working on adding images to existing powerpoint with matlab code. Your code helps me but instead of plotting figure in matlab, I have to add only .jpg figure.
So how can I change this code so that it will help me to copy specific image at specified location?
Any help would be appreciated!!

请先登录,再进行评论。

采纳的回答

Sebastian Castro
Sebastian Castro 2015-4-15

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Use COM Objects in MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by