Cannot execute the "nexttile" function.

4 次查看(过去 30 天)
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