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

조회 수: 8 (최근 30일)
Stephanie Farney
Stephanie Farney 2020년 6월 23일
댓글: Andreas 2023년 2월 10일
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