Problem with plotting dots in points

3 visualizaciones (últimos 30 días)
Thomas Wans
Thomas Wans el 17 de Mzo. de 2022
Editada: Jan el 18 de Mzo. de 2022
Hi,
I have problem I wanted to plot dots in points but It shows only last dot
figure(2);
A = [1,2,3,4,5,6,7,8]
Y = [1,2,3,4,5,6,7,8]
i = 8;
for c = 1:i
hold on
plot(A(i),Y(i),'r.')
end

Respuestas (1)

Jan
Jan el 17 de Mzo. de 2022
Editada: Jan el 17 de Mzo. de 2022
The loop does not depend on the loop counter:
i = 8; % <- this is the index in all iterations
for c = 1:8
I assume you mean:
for i = 1:8
  2 comentarios
Thomas Wans
Thomas Wans el 17 de Mzo. de 2022
Yes, but it still shows only last dot
Jan
Jan el 18 de Mzo. de 2022
Editada: Jan el 18 de Mzo. de 2022
Nope. This works:
figure;
A = [1,2,3,4,5,6,7,8];
Y = [1,2,3,4,5,6,7,8];
for i = 1:8
hold on
plot(A(i),Y(i),'r.')
end

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Performance 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