How do I work with a two dimensional array with for loops in MATLAB?
조회 수: 24 (최근 30일)
이전 댓글 표시
How can I do two dimensions array using a FOR loop? Example:
P = {k,l,m,n};
L = 4;
for i=1:L
New(i) = P(i);
end
I don't know how can i do write that result was array in two dimension: New = {k,l,m,n;k,l,m,n;k,l,m,n;k,l,m,n};
댓글 수: 0
채택된 답변
추가 답변 (1개)
Sean de Wolski
2011년 1월 24일
Best way would be:
New = repmat(P,4,1);
You should also read up on indexing cell arrays.
댓글 수: 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!