Connect different points with line in matlab <p>I have matrix of 2 column (x and y) and 100 rows, and each row make one point like (x1,y1). </p> <p>I need to draw a line consecutively between them, like point (x1,y1) to (x2,y2) and (x2,y2) to (x3,y3) and so on till (x100,y100).</p> <p>I have written this code and it's working properly. The problem is, it takes too long as I have to do this for 55000 matrix.</p> <pre><code> figure; for j=1:length(data); % data = 55000 different matrices which should draw in the same figure for i=1:length(data(j).x); x= (data(j).x(i)); y= (data(j).y(i)); if i == length(data(j).x); break; end x1= (data(j).x(i+1)); y1= (data(j).y(i+1)); line([x,x1],[y,y1]); end end </code></pre> <p>Is there any more efficient and quicker way to do that?</p>