Problem with plotting dots in points

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

답변 (1개)

Jan
Jan 2022년 3월 17일
편집: Jan 2022년 3월 17일

0 개 추천

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

Thomas Wans
Thomas Wans 2022년 3월 17일
Yes, but it still shows only last dot
Jan
Jan 2022년 3월 18일
편집: Jan 2022년 3월 18일
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

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

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2022년 3월 17일

편집:

Jan
2022년 3월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by