
How to draw bunch of line segments?
48 views (last 30 days)
Show older comments
I would like to draw [x1 x2],[y1 y2] line segments, and I have data in the form X1(i) = x1 etc. and i=1:1000; Is it possible to draw the lines without a for cycle?
0 Comments
Accepted Answer
Jan
on 22 Aug 2017
You can. But what is the wanted result?
X1 = rand(1, 10);
X2 = rand(1, 10);
Y1 = rand(1, 10);
Y2 = rand(1, 10);
subplot(1,2,1)
plot([X1; X2], [Y1; Y2]) % A bunch of separate lines
subplot(1,2,2)
plot([X1; X2].', [Y1; Y2].') % Two polygones

0 Comments
More Answers (1)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!