Borrar filtros
Borrar filtros

Bit shift operation on 2d array problem

1 visualización (últimos 30 días)
GLW
GLW el 30 de Mayo de 2013
I'm writing some behavioral code for testing an embedded matlab block that ouputs serial data. I want to capture the serial data using a 2d array structure being 120 elements deep by 24 bits wide. The incoming serial data is shifted to the left, then when 24 bits have been captured the next element is filled and so on.
this is the command that I use to perform the shift:
Arr(IndexCnt)(24:2) = horzcat(Arr(IndexCnt)(23:2),serdat)
The error I get is:
"Parse error: ()-indexing must appear last in an index expression."
Any idea where I'm going wrong?
Many thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 30 de Mayo de 2013
24:2 would be the empty list, as would be 23:2 . Perhaps you want 24:-1:2 and 23:-1:2 ?
MATLAB does not permit indexing by bits. MATLAB uses bitget() and bitset(). bitset() is unfortunately not designed to be able to set multiple bits simultaneously for arrays.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by