How to plot lines between all these points

Hi,
I have a matrix V, which is a 5-by-2 matrix, where each row represents a point in the xy-plain. How can I connect these points together in MATLAB, please?
Thanks in advance

 采纳的回答

Does this do what you need?
V(6,:) = V(1,:); % To connect at the end. Assumes size(V,1) = 5;
line(V(:,1),V(:,2))

4 个评论

This works like charm. I now get the point. Thank you
But how is this going to be in 3D? i.e.: if the matrix is 5-by-3?
V(6,:) = V(1,:);
line(V(:,1),V(:,2),V(:,3))
This did not work, I just got two crossed lines in 2D. Why?

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by