How can i save a vector with a variable length ?
13 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Thorsten
2013-1-9
Use a cell V to store the vectors
for i = 1:N
vec_of_variable_length = ...
V{i} = vec_of_variable_length;
end
更多回答(1 个)
Jan
2013-1-9
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!