How to reference every column individually in a growing matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all
Ive got a matrix, called "Matrix A".
It has 5 columns per every iteration of a "for" loop.
(that's 1 column for each of 4 datasets generated earlier on in the for-loop, plus a 5th "NaN" column used for spacing)
First iteration, Matrix A begins with 5 columns.... second iteration of the for-loop, matrix A ends up with 10 columns, 3rd iteration, 15 columns.
Now, I need to reference each column of that growing matrix INDIVIDUALLY, because the next function, called "padcat", adds "Nan" (Not a Number) to the ends of every column shorter than the absolute longest column, so that all columns in Matrix "A" end up the same length. You need that so you can plot the data in matrix A.
thing is, that padcat function can't take a matrix as input, only columns. I want all the columns in the PREVIOUS iteration's "A" matrix to go into the CURRENT iteration's padcat function. But the padcat function requires a list of every *column* to be used as an input.
But how can I reference every column in the previous matrix A, when the matrix itself grows every iteration of the for-loop?
I tried [A(:,1) , A(:,5K)]
Which is a range from the first column of matrix "A" to the column of A 5 times the number of iterations (K), but that just creates another matrix. It wont split up the matrix into columns
Thanks in advance
2 commentaires
madhan ravi
le 16 Mar 2019
if you illustrate with a short example you can do with the in-built function/s.
Réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!