Effacer les filtres
Effacer les filtres

Bit shift operation on 2d array problem

1 vue (au cours des 30 derniers jours)
GLW
GLW le 30 Mai 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

Réponses (1)

Walter Roberson
Walter Roberson le 30 Mai 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.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by