%add_ex3 data = [8 1.5 0; 5 -1 1; 1 -3 1; 11 2 1; 15 2 -1; 3 -3 0; 10 1 1; 14 1 -1; 2 -3 -1; 9 1.5 1; 6 -1 -1; 12 1.5 1; 4 -1 0; 7 -1 0; 13 1.5 -1;]; plot(data); title('Starting data'); [y,index] = sort(data(:,1)); for i=1:length(data(:,1)) out(i,:) = data(index(i),:); end figure(2) plot(out); title('Data sorted on the first column');