How can I avoid repeated figure output after a section break in Live Editor?
조회 수: 19 (최근 30일)
이전 댓글 표시
If I save a figure handle and modify the figure in different sections of my code, the Live Editor keeps re-outputting those figures.
The following code ouputs the figure only once without section breaks, but 3 times with the section breaks present.
f = figure;
plot(magic(5));
% section break
f.Position = [0 0 640 480];
% section break
saveas(f,"magic.png");
If I check for f.Visible, it is already off before the repeated output.
Is it possible to somehow suppress the repeated output of figures after a section break?
댓글 수: 0
채택된 답변
Cris LaPierre
2021년 8월 23일
I don't believe you can. This behavior is built into the design of live scripts. At each section break if anything has been done to a figure, you get a new snapshot of the figure. Perhaps it's helpful to think of it that way. These are not 3 separate figures, but snapshots of the same figure as it is modified by your code.
댓글 수: 4
Cris LaPierre
2021년 8월 26일
That is true. Section breaks are used to control what code runs when a control is changed.
The logic, then, is if the code associated with a control modifies a figure, don't you want to see the updated figure?
If you have a reason why not, please do include those details in your feature request. Coding-wise, you clearly know what you are doing
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!