matrix equation in loop form
조회 수: 1 (최근 30일)
이전 댓글 표시
I would like to creat a matrix, by using the loop structure, because i have a very big values, I tried this code but no result ; any help please
A=[2 2 6 6 4 4;2 2 6 6 4 4]
for n=1:length(A)
for m=1:2
if n=1:2 & m=1:2
A=2
elseif n=3:4 & m=1:2
A=6
else
A=4
end
end
end
댓글 수: 8
Voss
2022년 5월 11일
Maybe one of these is useful:
A = repelem([2 6 4],2,2)
A = kron([1 3 2],2*ones(2))
답변 (0개)
참고 항목
카테고리
Help Center 및 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!