Simulink: Can 2D selector block return a whole column if there is only 1 column?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Attempting to use the selector block in simulink with the following settings:
- number of input dimension: 2
- index option 1: select all
- index option 2: index vector (port)
My goal here is to be able to pick off columns from a matrix. If for example, I attempt to select column 1 via the index vector port, it works just fine so long as the matrix has more than one column. However, if there is only one column, the selector block returns element (1,1) instead of the entire column.
Is there a way to make this work how I'd like? It should be the equivalent of M(:,idx), but is not. I think it's attempting to be intelligent about the fact that I'm using a selector block on a [nx1] matrix and use the index value for the rows. But really in this case, I'd want to have the whole column returned.
And yes, I realize this would be an empty step, essentially returning the same as the input, however due to the nature of the code, the size of the matrix is undetermined until initialization. So I need the option to pick out a column from a matrix, whether there is only 1 column, or 50.
Thanks!!
0 Commenti
Risposte (1)
Sriram Narayanan
il 4 Mag 2015
I am assuming that you are using MATLAB 8.5 (R2015a). On R2015a, I used the selector with your settings on a new model and I was able to retrieve the 1st column irrespective of whether I passed a N x 1 or a N x N matrix.
Please find the model attached.
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!