2

I've got a script I've been working on that publishes figures I create into power point, consecutively. Each figure that is created is assigned a figure handle in the previous script. However, when I try to print each figure into a pdf, it will only return a copy of the PDF with my final figure handle (FH6). How can i get this script to print each figure, FH1-FH6, into a single pdf or their own separate pdfs. Thank you for your time

Here is an example of what i have:

close all
clear
get_mlo_data
import mlreportgen.ppt.*;

slidesFile ='mySlides_v1.pptx';
delete(slidesFile)
slides = Presentation(slidesFile);

slide1 = add(slides,'Title Slide');
replace(slide1,'Title','Research Presentation');
replace(slide1,'Subtitle','Author');

insertmyimage(fh1,slides,'CO2 Trends')
insertmyimage(fh2,slides,'Keeling Curve')
insertmyimage(fh3,slides,'Interpolated Vs Trend')
insertmyimage(fh4,slides,'DOTS')
insertmyimage(fh5,slides,'Seasonal')
insertmyimage(fh6,slides,'Keeling Spiral')

please_god = get(groot, 'Children');
print('please_god','-dpdf')

close(slides);

function insertmyimage(FigureHandle,slides,FigureTitle)
import mlreportgen.ppt.*;
tempimgname = ['WayneImage' num2str(numel(slides.Children)+1) '.png'];
saveas(FigureHandle,tempimgname);
tempplot = Picture(tempimgname);
pictureSlide = add(slides,'Title and Content');
replace(pictureSlide,'Title',FigureTitle);
replace(pictureSlide,'Content',tempplot)
end

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.