Bit shift operation on 2d array problem
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
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.
0 commentaires
Voir également
Catégories
En savoir plus sur Construct and Work with Object Arrays 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!