Borrar filtros
Borrar filtros

how to create random marker indices in a loop?

42 visualizaciones (últimos 30 días)
Barry Allen
Barry Allen el 20 de Abr. de 2020
Comentada: Holden Tranquillo el 30 de Oct. de 2023
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

Respuesta aceptada

Mehmed Saad
Mehmed Saad el 20 de Abr. de 2020
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 comentario
Holden Tranquillo
Holden Tranquillo el 30 de Oct. de 2023
This works well until i = 13 and then mod(13,13) is 0 :-)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by