Create new vector based on element pairs of another vector
I have a vector [A], which can have any number of even rows and will contain only zeros or ones in each element. I would then like to create another vector [B], which will always have one more than half the number of rows in [A]. The top row element of [B] is always 1, and the following elements depend on the corresponding pairs of elements in [A], working from top to bottom. The element of [B] should be zero only if both the corresponding two elements of [A] are zero, otherwise it should be one. Something like this for a 4 row [A] and 3 row [B]:





And for a 6 row [A] and 4 row [B]:

Hopefully someone can help me out!
Thanks.




