The Math Forum

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.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Lengths of Continuous Line/Vector
Replies: 4   Last Post: Jun 15, 2014 3:06 AM

Advanced Search

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

Posts: 40
Registered: 1/22/11
Lengths of Continuous Line/Vector
Posted: Jan 6, 2013 1:18 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Let us define vector y = [0 0 0 1 1 1 1 0 0 0 1 1 0]
I would like to extract the length of the continuous line
(i.e: ones = [4,2], zeros = [3,3,1])
I tried y(1:end-1)>y(2:end) and y(1:end-1)<y(2:end) but in case y start in ones or in case y(1) ~= y(end) it make me a lot of problem.

Is there a better way to extract those lengths?

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.