Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to select adjacent elements from an array?
Replies: 3   Last Post: Sep 24, 2013 11:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bart

Posts: 2
Registered: 9/23/13
How to select adjacent elements from an array?
Posted: Sep 23, 2013 4:43 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.