Cannot execute the "nexttile" function.

조회 수: 5 (최근 30일)
Waqar
Waqar 2023년 3월 1일
답변: DUY Nguyen 2023년 3월 2일
I tried to code for tiled plots as I was learning the tiledlayout/nexttile function. Although the code ran fine initially, it now shows error in ''nexttile'' function as follows:
Error in nexttile
Error in plot_run (line 10)
nexttile
My code was as follows:
tiledlayout(2,2);
x= linspace(0, 180);
y1= sin(x);
y2= cos(x);
y3= sin(x) + 2;
y4= cos(x)+2;
y5= tan(x);
nexttile
plot(x,y1)
ylabel("abra")
xlabel("speed")
hold on
plot(x,y5);
legend("GABA", "Glx")
ylabel("kadabra")
xlabel("speed")
hold off
nexttile
plot(x,y2)
ylabel("eeni")
xlabel("speed")
nexttile
plot(x,y3)
ylabel("meeinie")
xlabel("speed")
nexttile
plot(x,y4)
ylabel("mainie")
xlabel("speed")
  댓글 수: 1
Rik
Rik 2023년 3월 1일
If you format your code as code, you can run it through the forum interface, making sure we can see the full error message. I suspect this code will run fine of its own, so the full error (all the red text) is important information.

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

답변 (1개)

DUY Nguyen
DUY Nguyen 2023년 3월 2일
Hi, I run the above code normally. "Make sure to keep the tiled layout axes open and active before calling the nexttile function.
tiledlayout(2,2);
x= linspace(0, 180);
y1= sin(x);
y2= cos(x);
y3= sin(x) + 2;
y4= cos(x)+2;
y5= tan(x);
nexttile
plot(x,y1)
ylabel("abra")
xlabel("speed")
hold on
plot(x,y5);
legend("GABA", "Glx")
ylabel("kadabra")
xlabel("speed")
hold off
nexttile
plot(x,y2)
ylabel("eeni")
xlabel("speed")
nexttile
plot(x,y3)
ylabel("meeinie")
xlabel("speed")
nexttile
plot(x,y4)
ylabel("mainie")
xlabel("speed")

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by