Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Bart
Posts:
3
Registered:
9/23/13


How to select adjacent elements from an array?
Posted:
Sep 23, 2013 4:43 AM


Hello,
So if for example I have an array which looks like this:
array = [1 2 3 4 5 8 9 10 11 73 74]
I want a script which creates separate vectors with the adjacent elements, so:
data.first = [1 2 3 4 5] data.second = [8 9 10 11] data.third = [73 74]
The number of vectors is equal to the number of groups of adjacent elements.
Thank you.



