As I can solve the following problem binary
Show older comments
Yo tengo la siguiente secuencia binaria:
s=[1(1) 1(2) 1(3) 0(4) 1(5) 0(6) 0(7) 0(8) 0(9) 1(10) 1(11) 4(12)];
y quiero que me realice calcule las substrings de longitud n=4 de la siguiente manera:
1(9) 1(10) 1(11) 4(12)
0(6) 0(8) 1(10) 4(12)
1(3) 0(6) 1(9) 4(12)
He de decir que la longitud de las substrings deben poder modificarse, al igual que la longitud de la secuencia.
Muchas gracias
Accepted Answer
More Answers (1)
Andrei Bobrov
on 31 Oct 2013
n = 4;
idxend = 12;
idx = idxend + bsxfun(@times,1-n:0,(1:n-1)');
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!