How do I draw lines between all the the existing points.
2 views (last 30 days)
Show older comments
Hi I have points like P1=(x1,y1), P2= (x2,y2) .......Pn= (xn,yn).
I have to draw line between all the points. For instance if we have points P1,P2,P3and P4. I have to draw lines between P1 to P2, P1 to P3, P1 to P4, P2 to P3, P2 to P4 and P3 to P4. Any idea how do i achieve this? I can draw lines using function 'line' but I may get any number of points acording to the user's input and the lines must be drawn between all the existing points.
I have to also mention that each points(P1,P2,....Pn) are stored in a cell.
Any idea would be appreciable.
Thanks in advance.
1 Comment
Bjorn Gustavsson
on 8 Jul 2019
Surely this is a homework/programming task for an introduction to programming course? What have you tried so far? Have you understood how to use loops and how to use nested loops. You know how to plot a line between 2 points with the plot command?
Matlab tip:
hold on
Answers (0)
See Also
Categories
Find more on Surface and Mesh 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!