Diff but not when 0
5 views (last 30 days)
Show older comments
I need a way to do what diff does but ignore differences when the upper bound or lower bound is 0;
X = [1 1 2 0 5 0 13 21];
Y = diff(X)
Y =
0 1 -2 5 -5 13 8
X = [1 1 2 0 5 0 13 21];
Y = the_diff_I_Need(X)
Y =
0 1 0 0 0 0 8
Efficiency is important here.
Thanks
0 Comments
Accepted Answer
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!