Plotting in a specific axes in GUIDE

14 visualizaciones (últimos 30 días)
Olivia Rose
Olivia Rose el 25 de Abr. de 2022
Respondida: Cris LaPierre el 25 de Abr. de 2022
I have 2 axes, one for a negeative output and one for a positive output. The larger one is supposed to be the main one, first showing a circle with a particle moving about it's radius, then a bar graph of information. I tried plot(handles.axes1, x, y); but it looks wrong or returns an error. The bar graph outputs correctly afterwards.
This is the main plot I want to display first upon a button push. 'axes1' is where I want it, but it keeps plotting in 'axes8'.
x0 = 0;
y = 3;
for time=-7:0 % plotting the particle in motion
x = x0(1,:) + time;
plot(x, y,'ro');
axis ([-9 3 -3 3])
pause(.1)
end
t = linspace(0,2*pi); % plotting the cylinder
x = cos(t);
y = sin(t);
plot(3*x, 3*y)
axis equal
hold on
for t0 = t % plotting the particle moving about the cylinder in a clockwise rotation
h = plot(3*sin(t0), 3*cos(t0),'or');
pause(.03)
delete(h)
end
hold off

Respuestas (1)

Cris LaPierre
Cris LaPierre el 25 de Abr. de 2022
You must use the following syntax when plotting in an app/gui:
This tells MATLAB which axes to plot into. Without it, it creates a new figure window.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by