How to get part of 2D array from a 2D array. (i.e. 4x4 array to 2x2x4)
조회 수: 4 (최근 30일)
이전 댓글 표시
I would like to disassemble 2D array to specific size of 2D array as following image without "for loop".
I know, we can use for loop to get that.
test=[1 1 2 2; 1 1 2 2; 3 3 4 4; 3 3 4 4];
k=0;
for j=1:2:size(test,1)
for i=1:2:size(test,2)
k=k+1
DisassembleArray(:,:,k)=test(j:j+1,i:i+1)
end
end
Is it possible to disassemble 2D array as I mention?
If yes, could you show me a sample code?

댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!