I have matrix in
as shown, consisting of real numbers and 0. How can I sort it to become out
as shown?
in ={
{0, 0, 3.411, 0, 1.343},
{0, 0, 4.655, 2.555, 3.676},
{0, 3.888, 0, 3.867, 1.666}
};
out ={
{1.343, 3.411, 0, 0, 0},
{2.555, 3.676, 4.655, 0, 0},
{1.666, 3.867, 3.888, 0, 0}
};
This is related to a question I asked. It is much easier to add the columns by sorting it this way than in previous question, and easier to visualize than trying to take the first non-zero value in a row.