5.0

5.0 | 8 ratings Rate this file 83 Downloads (last 30 days) File Size: 19.14 KB File ID: #30124
image thumbnail

Smart PowerPoint Exporter

by Dmitriy Aronov

 

21 Jan 2011 (Updated 18 Feb 2011)

Exports Matlab figures to PowerPoint. Fixes formatting directly in PowerPoint to allow easy editing.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

This program exports a Matlab figure to PowerPoint and converts it into a group of PowerPoint objects. It then edits various object properties directly in PowerPoint, such that the figure can be easily modified without disrupting appearance, alignment, etc.

Program features:
(See Screenshot for summary)

- Exports using an added button on the Matlab toolbar or using command line code.

- Applies proper alignment and anchoring to all axis labels, tick labels and text boxes, such that they don't become misaligned following figure resizing or font changes in PowerPoint.

- Identifies logarithmic and scientific notation axes and applies superscripts in PowerPoint. This prevents the splitting of each superscripted label into two text boxes, which occurs during standard copy-pasting into PowerPoint.

- Converts each TEX-formatted textbox into a single properly formatted PowerPoint textbox. This prevents the splitting of TEX boxes into multiple objects. Converts all special TEX characters to Unicode.

- Removes unnecessary background color/outline objects that result from standard copy-pasting and instead edits these PowerPoint features directly.

- Combines pieces of each trace into a single PowerPoint group object to allow easy editing.

- Allows exporting object-dense parts of the figure as bitmaps, while leaving other parts in editable metafile format.

- Allows specifying the image resolution of both metafile and bitmap figure parts.

- Allows specifying the PowerPoint slide to which the figure is exported.

- Allows specifying the size and position of the exported figure.

- Allows grouping objects for speed and bulk-editing in PowerPoint.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
saveppt

MATLAB release MATLAB 7.10 (2010a)
Other requirements - Windows - Tested in Microsoft PowerPoint 2010
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (15)
04 May 2011 Cristina

This exporter is awesome. You won't have to regenerate matlab figures to make them legible, rescale subplots, change distances between functions, change colors, font size, add or remove tick marks to the axes, remove parts of your plot that you don't want on your slides etc. It takes most of the pain out of working with matlab figures :) thank you :) :) :)

28 Jul 2011 Etienne

Hi Dmitriy

My axes title labels are duplicated several times. I checked in the original, but there is only one instance. Have you seen this problem before?

26 Aug 2011 Federico Miorelli

Great idea and incredibly easy to use!
I have an issue with some types of plot though: for example if I plot any matrix with pcolor I get an error when exporting.

Thanks!

08 Sep 2011 Yuri Kotliarov

I was very excited about this function. But does it work with PowerPoint 2007? Not working for me. MATLAB 2011a.
pptfigure does not open figure and returns no error. If I create the figure myself then:
>> pptfigure(gcf)
??? Invoke Error, Dispatch Exception:
Source: Microsoft Office PowerPoint 2007
Description: ShapeRange.Item : Integer out of range. 2 is not in Index's valid range of 1 to 1.

16 Sep 2011 Boris

I tried this with PowerPoint 2010 SP1 on Windows XP SP3, using Matlab 2010a. The button appears, and when you click it, it opens PowerPoint, but then just generates a blank slide... No errors are given but it appears not to work (unfortunately)... I was trying to export a mixed area and line plot.

23 Sep 2011 Doug Harriman  
06 Oct 2011 Sander Aerts

I have the same problem as Boris. When i run the following:
>> clear all, close all
>> [~]=peaks;view(2);
>> pptfigure(1);
??? Invoke Error, Dispatch Exception:
Source: Microsoft PowerPoint 2010
Description: ShapeRange.Item : Integer out of range. 2 is not in Index's valid range of 1 to 1.
Help File:
Help Context ID: 0

Error in ==> pptfigure at 926
                invoke(pic.Item(2),'Delete');

Basically the same error but then with powerpoint 2010. It does however create a slide but the created object somehow appears to be totally blank.
If it worked properly I would certainly use this tool.

25 Oct 2011 Tim

Excellent program!

I initially had problems with the legend in the PowerPoint slide. For some reason if the symbol was a circle ('o') or square ('s'), it was removed. If I changed the symbols to something other than circles or squares, it seemed to be okay. As a temporary fix, I commented out line 939, and all symbols made it.

938 if isempty(deblank(txt)) returns 939 %invoke(pic.Item(c),'Delete');

If you have a better fix, please let me know.

Thanks!
                    

28 Dec 2011 Hugh

Hi, I typed "pptfigure", nothing happended. What did I do wrong?

02 Feb 2012 Guy

Similar to Hugh's problem, If I already have PowerPoint open, it works great. If not, if I try to use this from either the command line or the figure button I get the following error:

??? Invoke Error, Dispatch Exception:
Source: Microsoft Office PowerPoint 2007
Description: Application.ActiveWindow : Invalid request. There is no currently
active document window.
Help File:
Help Context ID: 0

Error in ==> pptfigure at 343
wind = get(ppt,'ActiveWindow');
 
??? Error while evaluating uipushtool ClickedCallback

07 Feb 2012 Benjamin

As of Feb 2012, pptfigure does not seem to properly export colorbars to Power Point. I made two changes to the code to make colorbars work (at lines 874 & 1109):
@@ -874,6 +874,18 @@
         if ~isempty(find(legends==objects(obj),1))
             set(get(objects(obj),'children'),'visible','on');
         end
+ if strcmp(get(objects(obj),'Tag'), 'TMW_COLORBAR')
+ % For colorbars, parent axes need to be visible.
+ set(get(objects(obj), 'parent'),'visible','on');
+ % Make colorbar ticks temporarily invisible by clearing their
+ % text, but keep colorbar axis labels in same positions.
+ ytick = get(get(objects(obj), 'parent'),'ytick');
+ cbar_lbl = findobj(objects, 'Type','text', ...
+ 'Parent',get(objects(obj),'Parent'));
+ cbar_lbl_pos = get(cbar_lbl,'Position');
+ set(get(objects(obj), 'parent'),'ytick',[]);
+ set(cbar_lbl,{'Position'},cbar_lbl_pos);
+ end
         set(objects(find(invisible)),'visible','off'); %#ok<FNDSB>

         % Set axis positions to original values
@@ -1109,6 +1121,10 @@
         if strcmp(type,'text')
             set(objects(obj),'interpreter',interpreter);
         end
+ if strcmp(get(objects(obj),'Tag'), 'TMW_COLORBAR')
+ % Restore YTick values to colorbar axes
+ set(get(objects(obj), 'parent'),'ytick',ytick);
+ end
     end
 end

The problem is that the image containted within the colorbar axes does not display when its 'Visibile' property is set to 'on'.

25 Apr 2012 Darren

This is a fantastic file. However, I run into trouble trying to export text with the sprintf function. It ends up omitting the text. Thoughts?

04 May 2012 Joachim  
18 May 2012 Daniel Helmick

Works great in most situations. I really love this.

Also doesn't capture the plot correctly if lines are turned off during the copying process.

31 May 2012 claire OLDFIELD

It works great, except it doesn't preserve the transparency setting of the "fill" on my graph. Any idea how I can add that?
Thanks!

Please login to add a comment or rating.
Updates
10 Feb 2011

Improved speed, better documentation, fixed TEX exporting bug, added some optional exporting properties.

10 Feb 2011

Corrected documentation/acknowledgement typos

11 Feb 2011

Fixed minor bug during scientific axis exporting

18 Feb 2011

- Added options for exporting figure/axis background colors - Added bitmap exporting option - Added image resolution properties - Added full support for TEX formatting - Corrected minor bugs

Tag Activity for this File
Tag Applied By Date/Time
powerpoint Dmitriy Aronov 24 Jan 2011 10:50:01
graphics export Dmitriy Aronov 26 Jan 2011 19:41:50
external application interface Dmitriy Aronov 10 Feb 2011 10:50:31
tex Benjamin 13 Feb 2012 18:14:21
latex Benjamin 13 Feb 2012 18:14:21
graphics export Benjamin 13 Feb 2012 18:14:26
ppt Daniel 15 Apr 2012 08:43:35
slides Daniel 15 Apr 2012 08:43:35
scientific illustrations Daniel 15 Apr 2012 08:43:35
figure Daniel 15 Apr 2012 08:43:35

Contact us at files@mathworks.com