How to fill values between two values.
5 views (last 30 days)
Show older comments
A = [1 0 0 0 2 0 3 0 0 0 0 4 0 5 ....]
B = [1 1.25 1.5 1.75 2 2.5 3 3.2 3.4 3.6 3.8 4 4.5 5 ....]
Is there a function for this?
0 Comments
Accepted Answer
More Answers (1)
Andrei Bobrov
on 17 Nov 2015
A = [1 0 0 0 2 0 3 0 0 0 0 4 0 5];
t = A ~= 0;
x = 1:numel(A);
B = interp1(x(t),A(t),x);
0 Comments
See Also
Categories
Find more on Startup and Shutdown 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!