No BSD License  

Highlights from
MATLAB controls and writes PowerPoint

5.0

5.0 | 3 ratings Rate this file 36 Downloads (last 30 days) File Size: 1.53 KB File ID: #18457

MATLAB controls and writes PowerPoint

by

 

24 Jan 2008 (Updated )

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

| Watch this File

File Information
Description

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.

Acknowledgements

Saveppt inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Windows only
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
03 Mar 2014 Jason

Excellent intro and well commented.

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

Replace the add-slides section:
%% ADD SLIDES
% View the methods that can be invoked
Presentation.Slides.invoke
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:
>http://www.mathworks.com/matlabcentral/answers/99150

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:
winopen('ExamplePresentation.ppt')

12 Mar 2012 Scott

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

op=invoke(ppt.Presentations,'Add',0)

12 Mar 2012 Scott

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);

11 Jan 2012 Van

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

14 Sep 2009 Rodrigo Carvallo

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

19 Jun 2009 Andres

Very helpful demo script to get started. Thanks!

Contact us