how to plot by looping
Ältere Kommentare anzeigen
i would like to ask how to plot coordinate by looping
this is beause i have some "status" to be followed when plotting,
thus im using the loop to check the status (4th column) like below:-
if it equal to 1 the marker should be in -*
if it equal to 0 the marker should be in -o red color
if none of the above, it should draw line,
but i only got the marker type only, not the "else" part
how should i able to plot the line and different type of marker base on the status at the 4th column
cities6=[181 -12 70 2
56 -12 80 1
184 -12 90 2
185 -12 100 2
186 -12 110 2
187 -4 110 2
188 0 110 2
189 4 110 2
4 8 110 0];
xa6=cities6(:,2);
ya6=cities6(:,3);
noofcities6=cities6(:,1);
for s6=1:n6
status6=cities6(:,4);
labels6=cellstr(num2str(noofcities6(s6)));
if status6(s6) == 1,
plot(xa6(s6),ya6(s6),'-*');
text(xa6(s6),ya6(s6),labels6, 'VerticalAlignment','bottom','HorizontalAlignment','right');
hold on
end
if status6(s6) == 0,
plot(xa6(s6),ya6(s6),'-o','color','r');
text(xa6(s6),ya6(s6),labels6, 'VerticalAlignment','bottom','HorizontalAlignment','right','color','r');
hold on
else
plot(xa6(s6),ya6(s6),'-');
end
hold on
end
grid on
grid minor
Thank you.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!