MATLAB: Creating a rectangle with 4 points

rectangle

Hello, I have 4 points with (x,y,z) and I want to have a closed shape which connects them.
I actually want to draw 4 lines between the 4 points and make them a rectangle.
Thank you for help.

Best Answer

plot3([2 4 4 2 2],[1 1 5 5 1], [3 3 3 3 3], '-k') % for (x,y,z)
% plot([2 4 4 2 2],[1 1 5 5 1], '-k') % for (x,y)
grid on
axis equal