Manipulate multidimensional matrix in for loop
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi, I have a matrix called multidim with 2x100x3 values. I would like to make this a 6x100 matrix by adding the matrix defined in each page under the previous one.
for i = 1:2
matrix = [multidim(:,:,i);multidim(:,:,i+1)];
end
This is what I have tried, but this only works if I have a 2x100x2 matrix. How do I make this a loop which remembers the previous created matrix and uses this in order to keep adding rows from the next page?
댓글 수: 0
채택된 답변
Andrei Bobrov
2017년 5월 3일
a = num2cell(multidim,[1,2]);
matrix = cat(1,a{:});
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!