Assuming you have a numerical vector nums, you can use Matlab's sort function to sort the vector in ascending order and then use the replace function to replace the values. The following code demonstrates the process:
main.m317 chars10 lines
Output:
main.m18 chars2 lines
gistlibby LogSnag