swiping row in Matrix
Show older comments
i have this matrix (M)
M=[
1 NaN NaN 0.9 0.3;
2 14.1450 5.142 0.85 -0.1145;
3 NaN NaN NaN NaN;
4 NaN NaN 1.25 0.5;
5 18.45 9.3507 1.63 0.049;
6 NaN NaN NaN NaN;
7 17.16 0 0.7163 0.2791;
8 NaN NaN 1 0.35;
9 NaN NaN NaN NaN]
i want to reshape like this
P=[
1 1 17.16 0 0.7163 0.2791;
2 6 18.45 9.3507 1.63 0.049;
3 3 14.1450 5.142 0.85 -0.1145;
4 5 NaN NaN 1.25 0.5;
5 2 NaN NaN 0.9 0.3;
6 8 NaN NaN 1 0.35;
7 4 NaN NaN NaN NaN;
8 7 NaN NaN NaN NaN;
9 9 NaN NaN NaN NaN ]
NOTE: in first matrix 3rd coloum 7 row it has zero that why it came 1st
earlier it was 9x5 then it convert into 9x6
how can i make this?
6 Comments
Walter Roberson
on 26 Nov 2020
You seem to be doing a sort of some kind, but I do not see what sorting rule you are using? You mention column 3 but your second row has a higher value for that column than the third row does? And I do not understand where that second column is coming from ??
ANAND ASP
on 26 Nov 2020
ANAND ASP
on 26 Nov 2020
Walter Roberson
on 26 Nov 2020
2nd column indicate previous data's serial number
That does not appear to be the case. The previous serial number for the 18.45 row was 5, but it becomes 6 in the output. The previous serial number for the 17.16 line was 7, but it becomes 1 in the output.
ANAND ASP
on 26 Nov 2020
ANAND ASP
on 27 Nov 2020
Accepted Answer
More Answers (0)
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!