File Exchange

image thumbnail

MATLAB controls and writes PowerPoint

version 1.0 (1.53 KB) by

MATLAB as a COM client, Microsoft PowerPoint (or any Office 2003 application) as a COM server

8 Ratings



No License

The MATLAB functions XLSREAD and XLSWRITE open Microsoft Excel as a COM Automation Server in the background, and read or write data. Using the same mechanism, it is possible to open, write to, and fully control Microsoft PowerPoint from MATLAB. The advantage is that from a single tool, both the data analysis and the presentation creation can be scripted.

This is the same functionality used in Mark Brown's submission referenced below. Mark Brown's "saveppt.m" is a cleanly packaged solution, whereas this submission is an open script intended to show what's going on, and empower users to create their own customized "pptwrite" functions.

Comments and Ratings (11)

honghe Zhang

It's very useful to me


Wally (view profile)

yunxing song


Shaan (view profile)

Thanks for sharing this code
The code gives an error at this line with Powerpoint 2013

Image1 = Slide1.Shapes.AddPicture('C:\...\test1.png','msoFalse','msoTrue',100,20,500,500)

Error using
Invoke Error, Dispatch Exception:

Description: The specified file wasn't found.


dashen (view profile)


Jason (view profile)

Excellent intro and well commented.

Some helpful tips I uncovered for more recent versions of PowerPoint:

Replace the add-slides section:
% View the methods that can be invoked
blankSlide = Presentation.SlideMaster.CustomLayouts.Item(7)
% Add two slides via "Add" method
Slide1 = Presentation.Slides.AddSlide(1,blankSlide)
Slide2 = Presentation.Slides.AddSlide(2,blankSlide)

>Modified from 2007 example at:

I would also Find/Replace "'C:\..." with "[cd,'" and then close out the arrays at the replacement locations in this script.
This tweak should allow the code to run as-is in any location for example purposes.

Add this to the last line to open your presentation once the script finishes:


Scott (view profile)

Found a work around to ppt.Visible=0 not working.



Scott (view profile)

As of PPT 2010, you can no longer hide the application (ppt.Visible=0). You can only minimize it (ppt.WindowState = 2). However, you can still open a presentation hidden using
op = invoke(ppt.Presentations,'Open',filespec,[],[],0);


Van (view profile)

This code easily works, but for Office 2010, it fails.

Im a begginner using matlab and im interested in writting ppts from matlab 6.5 to microsoft ppt 2003.
I tried with this code but i couldnt do it. Someone knows how to use this code in 6.5. Do you have to change some lines of the code or something else to have success using this?
Is there another useful code to write ppt 2003 from matlab 6.5?

Thanks in Advance


Andres (view profile)

Very helpful demo script to get started. Thanks!

MATLAB Release
MATLAB 7.4 (R2007a)

Inspired by: saveppt

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video