Most of the time functions don't operate "externally", so SORTROWS doesn't alter your array P defined in the workspace. It creates a new sorted array that it outputs. You have to store this output back into P if you want P to be the sorted version. If you wanted to keep the original, you could store it into a new variable:
P_sorted = sortrows(P,7) ;
Best Answer