Question: How to sort matrix

Hi, I have a 18x1 matrix. I am trying to sort it from smallest value to the largest value. But how to I as it to show which was the original position?

For example, M is my 18x1 matrix, i wrote "sort(M)".

In matlab I would write [Q,F]=sort(M);

Q will rearrange it for me and F will tell me the original position where it is from.

Please advice. Thank you very much.

Please Wait...