Find NaN elements in a matrix
638 次查看(过去 30 天)
显示 更早的评论
Hi Guys,
How can I find the exact location of NaN elements in a matrix. I work with really large arrays (size 1500*200).
How can I find which row has a NaN value in a column matrix or vice versa.?
Thanks
N
0 个评论
采纳的回答
Walter Roberson
2011-10-12
[row, col] = find(isnan(YourMatrix));
6 个评论
Ana Paulina García
2020-10-5
for me this actually creates a 1x0 variable named row and another one named col. None of the variables tells me the index :(
更多回答(3 个)
Wayne King
2011-10-12
One way:
X = ones(10,4);
X(3,4) = NaN;
indices = find(isnan(X) == 1);
[I,J] = ind2sub(size(X),indices);
0 个评论
Elizabeth Drybrugh
2018-5-3
编辑:Elizabeth Drybrugh
2018-5-3
Do this to get the sum
sum(isnan(x))
For other functions, it depends on what you actually need....
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!