I'm curious if anyone can find a smart/clean way (other than a for loop of doing the following). Given a logical array x:
x = logical( [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0] );
For n = 1 I'd like: y = [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0];
For n = 2 I'd like: y = [0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0];
etc.
Best Answer