| MATLAB Central > MATLAB Newsreader > logical indexing question...? |
|
|
|
I have the following vector of 1's and 0's |
|
Subject: logical indexing question...? From: Arnaud Miege Date: 19 Nov, 2009 14:46:50 Message: 2 of 25 |
|
|
|
bits = [0;1;1;0;1;1;1;0;0;0;0;0;0;1;1;1;]; |
|
ah, thanks... |
|
matt you are a genius, thank you :) |
|
"happydude " <anonymousse@hotmail.com> wrote in message <he3k59$2tn$1@fred.mathworks.com>... |
|
"happydude " <anonymousse@hotmail.com> wrote in message <he3mdr$ofa$1@fred.mathworks.com>... |
|
Subject: logical indexing question...? From: Arnaud Miege Date: 19 Nov, 2009 15:05:38 Message: 8 of 25 |
|
|
|
Sorry Jos, the 15 was a typo. |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 17:09:04 Message: 10 of 25 |
|
also what if i have an extremely huge string of bits and i dont know how many times it will swtich back and forth? |
|
On Nov 19, 9:06 am, "happydude " <anonymou...@hotmail.com> wrote: |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 17:41:20 Message: 12 of 25 |
|
lets say we know the first bit string is zero... so the indexes will indicate at what points we change to 1 and back to zero etc |
|
As Nathan correctly points out, the recreated bitstring must be unique (by definition of recreated), but there is no way to create a unique bitstring given its length, the position where the transition occurs and the first bit in the general case. More information is needed to accomplish this. |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 18:38:19 Message: 14 of 25 |
|
Oh I see what you mean! My apologies! |
|
On Nov 19, 10:38 am, "happydude " <anonymou...@hotmail.com> wrote: |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 19:21:18 Message: 16 of 25 |
|
awesome.. this has blown me away! |
|
try this |
|
or if you want to find both a change to a zero and to a one try this: |
|
Here is another solution which should be much faster. |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 20:28:01 Message: 20 of 25 |
|
Matt, how about if you: |
|
On Nov 19, 12:28 pm, "happydude " <anonymou...@hotmail.com> wrote: |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 20:46:40 Message: 22 of 25 |
|
let me rephrase, so if you had |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 20:52:04 Message: 23 of 25 |
|
you replied so fast you beat my follow-up post :) |
|
On Nov 19, 12:46 pm, "happydude " <anonymou...@hotmail.com> wrote: |
|
Subject: logical indexing question...? From: happydude Date: 19 Nov, 2009 21:05:23 Message: 25 of 25 |
|
this seriously helped me out a lot... How did do it so quick? |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
| Tag Activity for This Thread | ||
|---|---|---|
| Tag | Applied By | Date/Time |
| logical indexin... | happydude | 19 Nov, 2009 09:24:23 |
Contact us at files@mathworks.com
