Caught "std::exception" Exception message is: createInputStream failed:

7 次查看(过去 30 天)
Hi all,
I'm working on a program in MATLAB 2019b to analyze test data and automatically generate a PowerPoint report of the results using mlreportgen.ppt. The code is set up to use a template to create the presentation and replace various uniquely named picture placeholders with the figures it generates. I unfortunately can't post my exact code, but here is a recreation of the relevant portions:
import mlreportgen.ppt.*
template = 'myTemplate.pptx';
newSlides = 'finalReport.pptx';
slides = Presentation(newSlides,template);
%code to generate plot
saveas(gcf, 'Fig1.png');
replace(slides,'Picture Placeholder Name', Picture('Fig1.png'));
close(slides);
The error is occurring at close(slides), and gives the following error message:
Caught "std::exception" Exception message is:
createInputStream failed:
In addition to replacing figures, the code is also set up to replace to replace titles and various textboxes in the PowerPoint. When you run the code without the commands to replace the pictures (leaving commands to replace text), it works fine, and when I give the close(slides) command, it generates a PowerPoint with the replaced text and all of the slides from the template. The error only occurs when I try to replace the picture placeholders with figures. When I inlude those commands, the resulting PowerPoint still has the replaced text, but all of the slides after the first slide I attempt to replace a picture on are deleted. I wasn't able to find any info on the exact error, but a similar error recommended using fclose('all') to solve it. I've tried including that command before close(slides), and it didn't help.
Have any of you encountered this error before? Thank you in advance for your help!
  3 个评论
Stephanie Farney
Stephanie Farney 2020-6-24
Thank you for your response! Both files are writeable, but double checking that info did end up leading me to the issue. I was saving the plots to a subfolder of the directory, and I didn't specify the subfolder in the replace function. Adding the full file path fixed the issue.
Andreas
Andreas 2023-2-10
Hello Stephanie Farney, could you please elaborate with an example. I am running into almost the exact issue you have and need some further insight.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by