I have this matrix: 2 2 82 10 16 15 66 76 71 83 44 49 4 2 91 28 98 43 4 75 4 70 39 45 4 1 13 55 96 92 85 40 28 32 77 65 1 2 92 96 49 80 94 66 5 96 80 71 1 2 64 97 81 96 68 18 10 4 19 76the code should look to first column,if its not repeated,gives the output:8 1 6 7 5 10 9 3 4 2 which is the indices after sorting in descending way.if its repeated,look to the second column if 1 ,the code should sort the elements of second line and distribute them as 1:7 to original and the rest to the repetitionif the of second column is 2 ,the code should divide 1:5 to first and 5:10 to the second.the result should look like:8 1 6 7 5 10 9 3 4 23 1 6 8 10 0 0 0 0 04 9 2 5 7 0 0 0 0 02 8 5 1 4 0 0 0 0 0
MATLAB: Matrix sorting and distibution
MATLABmatrix
Related Question
- How to rearrange the rows of a matrix
- Help running Matlab script
- Is it possible to extract the values with a vector of indices for each row without using the for statement from the matrix
- How to modify a matrix to change the entries >=0 and multiply it by 5 AND to change the entries <0 and add 2 to those entries
Best Answer