Live Script calls multiple functions that produce a plot, but only the last one shows up.

조회 수: 5 (최근 30일)
It looks something like this:
function LiveScript
plot1
plot2
end
function plot1
x = 0:pi/100:2*pi;
y = cos(x);
plot(x,y)
end
function plot2
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
end
LiveScript()
How do I get it to show all plots?
  댓글 수: 1
Nando
Nando 2025년 6월 12일
I'd be okay if they were different tabs in one window instead of in the Live Script Output, if that helps

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

채택된 답변

Walter Roberson
Walter Roberson 2025년 6월 12일
Graphics calls that are made directly from LiveScript output in-line, and each time a plot would be erased it instead starts a new plot leaving the old one visible.
Graphics calls that are made from .m files follow the older rules that commands that would cause a plot to be erased... just erase the previous plot ready to draw over it.
You will need to use one of:
  • figure() (not sure about uifigure())
  • subplot()
  • tiledlayout() / nexttile()
Or you could have plot1() and plot2() return the data and plot the results within the LiveScript.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by