If I have a matrix such as this:
A=[ 8 3 67 8 2 0 0 0 0 0; 8 76 9 233 1 89 34 0 0 0; 98 23 87 9 3 24 64 45 1 0]
and I use the command sort(A,2) it will sort alongside the columns but at the same time push the zeros forward. I would like to keep the 0’s to the end for computing purposes later on in the code.
I I have been looking for a command that does this, as I feel there is one.
I have also generally been trying to sort, flip, and transpose to get what I want but Im at an impasse.
You can replace the
0byInf, then sort and after the sort replace theInfby0once again.