I have a matrix A = [1 1 0 1; 1 0 0 0 ; 1 0 1 0 ; 1 1 1 1]; I count the number of 1's in each row and I get count=[3 1 2 4]. I want to get A' = [1 1 1 1; 1 1 0 1; 1 0 1 0; 1 0 0 0]; How to get it. TIA.
MATLAB: Sort rows based on number of 1’s in each row.
count number of 1sort row wise
Related Question
- Counting consecutive repeat values for each row in matrix
- How to descend order column that have maximum values zero in MATLAB
- Putting 1’s in the place of the highest numbers
- Row Sorting of Matrices
- Delete rows of different permutations of same set
- Count the number of 1 in each row
- How sort rows of matrix as per given index
Best Answer