필터 지우기
필터 지우기

Error using export function

조회 수: 21 (최근 30일)
Sabreen
Sabreen 2023년 4월 15일
댓글: Vinayak 2023년 4월 24일
I have a live script, and want to automatically export the output of the live script to a pdf file. To do this, I am using the export function:
% Name of output file
outputFile=strcat(filebase,timestr,'_OUTPUT.pdf');
% Export the PDF file to subfolder of current run
pdfPath = strcat(newdir,'/',outputFile)
pdfFile = export(strcat(simfile,".mlx"), pdfPath, OpenExportedFile=false, HideCode=true);
However, the resulting pdf contains the output from the last run and not the current run. From what I understand, this is because the export function only exports the last saved changes and the currently running live script output is not considered to be saved. What can I do to fix this and export the most recent ouput?
  댓글 수: 1
Vinayak
Vinayak 2023년 4월 24일
This can be fixed by saving the live script just before exporting the file.
% Name of output file
outputFile=strcat(filebase,timestr,'_OUTPUT.pdf');
% Export the PDF file to subfolder of current run
pdfPath = strcat(newdir,'/',outputFile)
% Save the live script
save(strcat(simfile,".mlx"));
% Export the PDF file
pdfFile = export(strcat(simfile,".mlx"), pdfPath, OpenExportedFile=false, HideCode=true);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by