Varying the name of variable within a for loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
Is there a way to change the name of a matrix within a 'for' loop? For example, i might have an initial vector:
x0=[1 1]
and within the loop, I would like to change the name of the matrix to x1. Writing x(i) obviously just populates that position with the matrix.
Thanks
댓글 수: 0
채택된 답변
Image Analyst
2012년 2월 8일
Read and understand the FAQ on this topic:
댓글 수: 2
Walter Roberson
2012년 2월 8일
You cannot. However, you can have x{5} be 1x2
for K = 1 : 10
x{K} = rand(1,2);
end
then
x{1}
x{2}
and so on.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!