how to find a block containing NaN in cell
Show older comments
hi sir,i have cell of 10*10 cell which look like below double <5x10 double> <5x10 double> <5x10 double> <5x10 double> <5x10 double> <5x10 double> <5x10 double> <5x10 double>
i have to find in which 5x10 double NaN is present
1 Comment
Jan
on 7 May 2015
The description of the data is not clear. Please post some code, which create a relevant set of test data - with small arrays.
Accepted Answer
More Answers (1)
Jan
on 7 May 2015
Perhaps:
x = {1:5, 2:6, [3,4,NaN,6,7]};
hasNaN = false(size(x));
for ix = 1:numel(x)
hasNaN(ix) = any(isnan(x{ix}));
end
A CELLFUN could do this also, but a loop is easier to understand and fast to write. Please explain at first if my guess matches your data.
Categories
Find more on Matrices and Arrays 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!