I have an array with the first column being x-coordinate, the second column being y-coordinate and then the next few columns being different values. I've used an if function so that all the y-coordinates are the same in the array but I then want to sort by x-coordinate (so my plot(x,y) is in order rather than jumping all over the place). The problem is that when I use the sort() function, it orders all my other columns too so the data is no longer associated with the correct coordinate.
This is a copy of the data unsorted.
This is after I've used the sort function. It also sorts column 3 which I don't want to happen. I want the 58.6480 value (column 3) to remain in the same row as the 20 value from column 1.