How can i save a vector with a variable length ?

조회 수: 16 (최근 30일)
Adrin
Adrin 2013년 1월 9일
댓글: Anwar 2022년 11월 6일
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,

채택된 답변

Thorsten
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
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.
  댓글 수: 1
Anwar
Anwar 2022년 11월 6일
hello Jan can you help me in a variable indexing task

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by