File Exchange

image thumbnail

subplotPPT

version 1.5.0.1 (10.7 KB) by Mark Hoyle
Saves multiple MATLAB figure windows to powerpoint giving the user "subplot" style control over thei

3 Downloads

Updated 01 Sep 2016

View License

Saves multiple MATLAB figure windows to powerpoint giving the user "subplot" style control over their positions in the final slide.
Given multiple figures you can use commands like:

subplotPPT(m,n,k,...) to print a copy of the figure to a powerpoint slide. The first three arguements behave like those of subplot: m rows of images, n columns amd k gives you the index of the image to paste to (if k has two element per image then the function will merge the image across the locations). Other inputs:

Vector of handles to figures to paste into the slide

Filename of powerpoint file to use

slide number to print to

Region of the slide to print to

image file format to print to (e.g jpg, png, bmp ...)

gaps between adjacent images

units for specifying measures in.

The zip file contains subplotPPT and test_PPTScript which runs through some examples of how to call the function

Example:

The code:

h(1) = figure;
peaks;
h(2) = figure;
membrane;
h(3) = figure;
spy;
h(4) = figure;
image;
h(5) = figure;
tori4;

subplotPPT(3,3,...
[1 4; 2 3; 5 5; 6 9; 7 8],...
h,[pwd,filesep,'test.ppt'],4,...
'region',[200 100 500 340],...
'hgap',10,'vgap',10,'units','pixels');

Generates the screenshot

Cite As

Mark Hoyle (2020). subplotPPT (https://www.mathworks.com/matlabcentral/fileexchange/20949-subplotppt), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

Resolved by calling subplotPPT_2007 although I am using Office 2013

I'm getting the same issue as David in MatLab R2017a, no solution yet

David Botto

I tried running Test_PPTScript using MatLab R2015b. I am getting the error message
"undefined function 'Add' for input arguments of type 'Interface.Microsoft_PowerPoint_14.0_Object_Library.Slides',
Error in subplotPPT (line 191)"
Any ideas of what I should do? Thanks,

I'm getting the following error message:

Invoke Error, Dispatch Exception:
Source: Microsoft PowerPoint 2010
Description: CustomLayouts.Item : Integer out of range. 7 is not in Index's valid range of 1 to 1.
Help File:
Help Context ID: 0

Can you help me?

Walid

Does it not work with 64 bit ?

Glenn

Very quick and useful. Now if I can only get my colleagues to adopt this as well.

How do I get the slide number to continue in the for loop.
For instance, I have 100 figures to put into my .ppt.
I have it set up for 2 figures on one slide starting on slide 8 of my .ppt template. How do I get figures 3 and 4 to be put on slide 9?
Thanks!

Stan Young

Tried on version 6.5 on Windows
After correcting the mkdir (for windows) The test script hung up around line 152 in subplotPPT when it was testing the existence of FileData.FileName. FileData was declared [] earlier and never initialized to anything else. Where am I going wrong?

Thierry Dalon

Good idea and implementation.

Carlos Adrian Vargas Aguilera

It works fine Mark! Is there any way to get the output in an image file (PNG for example) rather than in PPT?

Regards, Carlos

Updates

1.5.0.1

Updated license

1.5.0.0

Included Trademark Information

1.4.0.0

Added in copyright information

1.3.0.0

Now contains a file "subplotPPT_2007" for use with Office 2007. Thanks to Mykel Kochenderfer for pointing this out to me.

1.0.0.0

Fixing a bug in the previous code and adding the capability to save as an image file. Powerpoint allows you to save slides to a range of image file type. subplotPPT now lets you save the resulting slide to an image file. See test script for examples.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: saveppt, saveppt2