I have a matrix like below-
x=[1 1 1 1 1;
2 1 1 1 0;
3 3 1 0 0;
3 2 2 0 0];
But i want to make this matrix like-
x=[2 2 3 0 0;
1 3 3 0 0;
1 1 1 2 0;
1 1 1 1 1];
I have already tried with "sort ascending" but then '0' will come first but i want to keep "0" on last and make one matrix where the number of '1's' will be from low to high throughout the matrix.I am trying but cannot do so. I need Matlab experts help.