Straight line approximation of elements in array
7 views (last 30 days)
Show older comments
I have a 21x1 array in which every other value is NaN:
s=[0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5];
I need to make a straight line from one surrounding value to the other for each NaN. For this case, it would be the averages, like 0 NaN 5 would be 2.5, because the surrounding values are 0 and 5, which would make the NaN become 2.5.
Basically I need to replace all the NaNs in this fashion and plot the new array.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!