problem with matlab live script and the export function
이전 댓글 표시
Hello to all,
I have a problem with matlab live script and the export function.
My matlab live script code calls another matlab file which contains inputs.
When I run the code everything goes well but when I export it exports the old inputs that I had to enter.
For example, when I launch the code for the first time I enter in the different inputs :
a
b
c
d
when importing in htlm file these inputs will appear in the htlm file.
The problem will occur when I run it for the second time with inputs f, g, h, j, the file exported to htlm instead of containing f, g, h, j still contains a, b, c, d.
If I run it for a 3rd time with inputs q,w,s,x the exported file will contain this time f,g,h,j.
I want to specify that I used close all; clear all; clc at the beginning of each code.
I even used clear all output to fix this but this time when the file is exported I don't have the inputs displayed anymore.
Thanks for your help
Here is a part of my first code named main :
clc;clear class;close all;
format shortG
caracteristic=input(' Caracteristic : ',"s")
Name1=input(' Name1 : ',"s")
disp(" ")
Name2= input ("Name2 : ","s")
disp(" ")
Name3= input (" Name3 : ", "s")
disp(" ")
Name4= input (" Name4: ","s")
Here is a part of my second code named Result :
clc;clear; close all;
main.mlx
export("Result.mlx", "D:\desktop ", ...
HideCode=true,Format="html",OpenExportedFile=true);
Thanks for your help
답변 (2개)
Wendpagnangda Bryan Jaouad Précieux KONKOBO
2022년 7월 5일
1 개 추천
Yash Srivastava
2022년 6월 27일
0 개 추천
This is happening because the “export” function considers the last saved changes made to the file as “checkpoint” and exports that output. If the live script is running and changes are being made to the output (which in your case happens in the second line of “Result”), those changes will not be reflected in the "export" function’s output.
댓글 수: 3
Wendpagnangda Bryan Jaouad Précieux KONKOBO
2022년 6월 28일
Celina
2023년 4월 12일
Have you founda way around this? I'm struggeling with the same right now.
Sabreen
2023년 4월 15일
I have a similar problem, and created another live script where I ran the original live script (from which I want the output) and then attempted to export the output, as such:
run('OriginalLiveScript.mlx')
% Name of output file
outputFile=strcat(timestr,'_SIM_OUTPUT.pdf');
% Export the PDF file to subfolder of current run
pdfPath = strcat(newdir,'/',outputFile)
pdfFile = export("OriginalLiveScript.mlx", pdfPath, OpenExportedFile=false, HideCode=true);
However, the resulting pdf file is still showing the output of the previous run.
카테고리
도움말 센터 및 File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!