sample and hold kind of interpolation
Show older comments
Hi,
Say x =
[1 12 NaN;
2 NaN 6;
3 13 NaN;
4 NaN 7;
5 15 NaN;
7 17 NaN;
11 19 NaN;
12 NaN 9]
Without using loops, how can I replace NaNs with the previous values in each column, so that I have
x =
[1 12 0;
2 12 6;
3 13 6;
4 13 7;
5 15 7;
7 17 7;
11 19 7;
12 19 9]
Thanks a lot in advance,
axs
1 Comment
Walter Roberson
on 6 Feb 2012
It's a bit tricky without any for loop at all, but start with isnan()
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!