Based on a question on MATLAB Answers.
Find all the elements of a vector whose difference, regardless of position is less or equal than a given range.
Example
A = [1 4 7 10 2 8]; range = 1; inrange = [1 0 1 0 1 1]; % since diff(1, 2) <= 1 and diff(7, 8) <= 1
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers74
Suggested Problems
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
2071 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1331 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
653 Solvers
-
Getting the row and column location from a matrix
301 Solvers
-
Set the array elements whose value is 13 to 0
1458 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I love the fact that you based this on a question from Answers! I kind of wanted to link back to it, but I can see that you might not want people to see your answer.