How to avoid or delete Nan values in addtion?
Show older comments
if i have2 matrix
A=[2 NaN ; 3 NaN]
B=[NaN 4 ; NaN 5]
I want C as
[2 4 ; 3 5 ]
edited by guillaume: Nan is not valid in matlab. NaN or nan is.
Accepted Answer
More Answers (1)
Guillaume
on 10 Oct 2018
If I understood correctly,
C = sum(cat(3, A, B), 3, 'omitnan')
Categories
Find more on NaNs 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!