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


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
How to select adjacent elements from an array?
Replies:
5
Last Post:
May 26, 2015 5:59 PM



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.



