Simulink block to extract signal at index from vector signal doesn't exist?
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hey,
I'm looking for a block that takes 2 input signals: One vector signal and one integer index signal. The output would be
vector(index)
Am I just too stupid to find it or does that block really not exist? Any workarounds?
I need this for use with the Simulink HDL Coder.
Kind regards and many thanks in advance,
Eike
0 commentaires
Réponse acceptée
Plus de réponses (3)
Tim McBrayer
le 21 Mar 2012
The block you are looking for is the Multiport Switch block, located in the Simulink->Signal Routing library. This block is supported by Simulink HDL Coder. For your use case you will want to configure it to have one input port. Connect port one to your index signal, and port 2 to your vector signal. The output will be:
vector(index)
You can choose either zero-based or one-based indexing.
3 commentaires
David Amor
le 10 Juin 2014
Are you trying to get a single bit from a vector at an index? If so bitget would be easier and less verbose.
ans = bitget(vector,index);
but if you are trying to access a vector from an array of vectors then yeah, you need the selector block.
0 commentaires
Bibek
le 1 Avr 2015
Is there any block which will give the index from the value selected!!
0 commentaires
Voir également
Catégories
En savoir plus sur HDL Coder 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!