Did you know that you could automatically generate reports from your MATLAB program? You can publish a report in various formats -- HTML, PDF, LaTeX, XML, Microsoft® Word® (only on Windows®), and Microsoft PowerPoint (only on Windows). For PowerPoint output, each section of the program is put into a separate slide, and you can apply formatting afterwards in PowerPoint.
There are a number of File Exchange entries that allow you to programmatically create PowerPoint slides with formatting capabilities, including saveppt (Pick of the Week post), subplotPPT, and officedoc. These entries all use the COM interface to create the PowerPoint document and, therefore, require a Windows platform and PowerPoint. Stefan's exportToPPTX creates the document completely "natively" by creating the necessary XML files and packing them into a PPTX file. That means that this works in any platform that runs MATLAB, and you don't need to have PowerPoint installed. Since this is XML writing, it's much faster than the other COM interface counterparts.
Stefan includes a detailed example that showcases the various formatting options included with the function. As you can see from the animation of the slides below, here are some of the formatting options:
- Setting the size of the slides
- Adding pictures (from figures, axes, image files, CDATA)
- Setting the position and scale of pictures
- Adding text and specifying positions, angles, and font properties
- Adding notes to the slides
- Specifying slide background color.
Do you create presentation slides from your MATLAB results? How do you currently do that? If you haven't used exportToPPTX, give it a try and let us know what you think here or leave a comment for Stefan.
Get the MATLAB code
Published with MATLAB® R2013b
3 CommentsOldest to Newest
I’ve written a Matlab object to handle the COM interface with PowerPoint. I wrote my code years ago when I found that, at least then, the tools in the FEX all opened and closed PowerPoint in a single function call. My code starts PowerPoint when the object is created. The object stores the COM objects for PowerPoint and the Presentation. Methods are then used to add title slides, text slides, tables, or figures as desired. The file can then be saved and closed at the end. This saves the overhead of constantly restarting PowerPoint. I have similar objects for Word and Excel.
Using the XML interface is interesting. I’ve done something similar for exporting to Mathcad. The COM interface works well for me, though, as I’m always using Windows machines with PowerPoint installed.
Yes, I think using objects is a good way to implement such functionality, since it makes it easy to manage the COM objects that are being operated on.
Do you have your functions on the File Exchange? I think I’ve seen similar functionality for Excel before, but I’m not sure.
@Jiro: Unfortunately corporate rules preclude me from posting to the FEX.