How to find location/coordinates of NaN in a sort condition?
1 次查看(过去 30 天)
显示 更早的评论
I have a matrix like this:
3 2 3 6 2
9 4 NaN 4 2
NaN 3 2 4 3
7 2 NaN 9 3
7 1 8 2 4
So the location/coordinates NaN that will be out in a sort condition is(2,3),(3,1), and(4,3).
I've already try this code:
[I,J] = find(isnan(Data));
but the value does't well organized. is the any solution? thanks before :')
0 个评论
采纳的回答
Andrei Bobrov
2012-4-27
[ii jj] = find(isnan(Data));
outij = sortrows([ii jj],1);
OR
[jj ii] = find(isnan(Data.'))
2 个评论
Jan
2012-4-27
Matrices are store in column order in Matlab. Therefore the output of FIND *is* well organized, but not in the order you expect.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!