My for loop is replacing all values of my array with the last iteration.
이전 댓글 표시
The point of this loop is to create multiple square 4X4 matrices stored in one variable A, for which the 2 values in the matrix change and are extracted from a 3X20 matrix I have previously created. My for loop, below keeps creates a cell array with 60 elements (like I want) but when the loop is done all the values change to the very last. How can I keep this from happening?
if true
% for i=1:a
for j= 1:b
for k=1:(a*b)
A{k}=[0,1,0,0;-1,0,msigmasq(i,j),0;0,0,0,1;1,0,mplus1sigmasq(i,j),0]
A{1}
end
end
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!