how to create random marker indices in a loop?

조회 수: 31 (최근 30일)
Barry Allen
Barry Allen 2020년 4월 20일
댓글: Holden Tranquillo 2023년 10월 30일
I want to plot different marker indices , i have written the code in for loop and the plot function comes under the loop.So I need to create different marker for the plots in the same figure.
for i=2:6
xxxx;
YYYY;
plot(x,y,'Marker','?')
hold
end
what should i change in the question mark area to obtain a different markers

채택된 답변

Mehmed Saad
Mehmed Saad 2020년 4월 20일
figure,hold on
x = 1:10;
all_marks = {'o','+','*','.','x','s','d','^','v','>','<','p','h'};
for i=1:6
y = rand(1,10);
plot(x,y,'LineStyle','none','Marker',all_marks{mod(i,13)})
end
  댓글 수: 1
Holden Tranquillo
Holden Tranquillo 2023년 10월 30일
This works well until i = 13 and then mod(13,13) is 0 :-)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by