Delete NaN in arrays in a cell

6 views (last 30 days)
Rudolf
Rudolf on 6 May 2021
Commented: Rudolf on 6 May 2021
I have a 1x20 cell containing 20 arrays of double. Some of these arrays contains NaN. How can i delete them?
(If an array of double with 1 NaN is 101 long, it should be 100 after) Hope i explained it good enough.

Accepted Answer

KSSV
KSSV on 6 May 2021
Let C be your cell array;
iwant = C ;
for i = 1:length(C)
idx = isnan(C{i}) ;
iwant{i} = C{i}(~idx) ;
end

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!