How to find NaN values in a cell array.
Show older comments
This is my data:
a = {'raja' 'I' 76 56 NaN;'bala' 'R' 12 7 56;'kavi' NaN 56 5 12}
X = find(isnan(a));
I got
??? undefined function or method 'isnan'
for input arguments of type 'cell'.
Accepted Answer
More Answers (1)
the cyclist
on 30 Dec 2016
Edited: the cyclist
on 30 Dec 2016
Here is one way:
find(cell2mat(cellfun(@(x)any(isnan(x)),a,'UniformOutput',false)))
I had to stick the "any" command in there to deal with the strings, but I think this still does what you intend.
Categories
Find more on Image Arithmetic 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!