Cannot execute the "nexttile" function.

12 visualizaciones (últimos 30 días)
Waqar
Waqar el 1 de Mzo. de 2023
Respondida: DUY Nguyen el 2 de Mzo. de 2023
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 comentario
Rik
Rik el 1 de Mzo. de 2023
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.

Iniciar sesión para comentar.

Respuestas (1)

DUY Nguyen
DUY Nguyen el 2 de Mzo. de 2023
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")

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by