MATLAB: How to loop through each (x,y) pair in MATLAB? : <p>So I want to create a loop in MATLAB where I can retrieve the x,y pairs. </p>

<p>So far, I have two arrays:</p>

<pre><code>x = [x1 x2 x2 x1 x1];
y = [y1 y1 y2 y2 y1];
</code></pre>

<p>I would like to create a for loop where I can retrieve pairs (x1,y1), then (x2, y1), then (x2, y2), (x1, y2), and lastly (x1,y1) once again. </p>
