How can i save a vector with a variable length ?
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I have vector (ind), used in a while loop and whose length is changing in every loop. I need to save (in a table or a mtrix-if it's possible)the value of this vector in each iteration and ofcourse before it change. Thanks you,
0 commentaires
Réponse acceptée
Thorsten
le 9 Jan 2013
Use a cell V to store the vectors
for i = 1:N
vec_of_variable_length = ...
V{i} = vec_of_variable_length;
end
Plus de réponses (1)
Jan
le 9 Jan 2013
You cannot store vectors of different length in a matrix, because matrices are rectangular by definition. Using a cell vector as in Thorsten's example is sufficient.
1 commentaire
Voir également
Catégories
En savoir plus sur Matrices and 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!