How can i decode(unpack) an array of bits with a constant value?

For example; I have an array; [0 0 0 1 1 1 0 0 0]. and a constant value L= 3 how can i get the output as; [0 1 0] ?

 Akzeptierte Antwort

Not sure what the "rule" really is for getting the bits. Maybe one of these?
x = your vector
L = your number
result = x(1:L:end);
or maybe
result = any(reshape(x,L,[]));
or maybe
result = all(reshape(x,L,[]));
If not one of the above, then maybe you could give us more details on the "rules" for the unpacking.

Weitere Antworten (0)

Kategorien

Mehr zu Powertrain Blockset finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 13 Dez. 2017

Kommentiert:

am 13 Dez. 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by