MATLAB: Is there an example of using MATLAB to create PowerPoint slides

actxservercomMATLABMATLAB Report Generatorpowerpointreportgeneratorslide

Is there a way, from MATLAB, to write images and content directly into PowerPoint slides? Do you have any examples of how to do this?

Best Answer

There are three options for using MATLAB R2018b to create PowerPoint slides.
1. Use the "Publish To" option in the MATLAB Editor. Consider an MATLAB script file in the MATLAB Editor, for example:
a = [1:10];
b = [1:10].^2;
plot(a,b,'b.')
In the MATLAB Editor menu, choose "File" -> "Publish To". You have your choice of HTML, XML, LaTeX, Word Document, or PowerPoint presentation. An advantage of this option is simplicity; a disadvantage is that you do not have full control of the output format.
2. Use the MATLAB Report Generator. This approach allows greater control over the resulting file, though it should be noted that the MATLAB Report Generator is not part of base MATLAB. A simple PowerPoint presentation can be created as follows:
import mlreportgen.ppt.*
slides = Presentation('myFirstPresentation');
add(slides,'Title Slide');
contents = find(slides,'Title');
replace(contents(1),'My First Presentation');
close(slides);
More options using the MATLAB Report Generator can be found here:
This functionality, using the Report Generator PowerPoint API, was introduced in MATLAB R2015b.
3. Open PowerPoint as a COM Automation server (Windows platforms only). See attached example. In considering this example, please note that it was tested only with Office 2003 on a 32-bit Windows XP platform.