question about command 'mat2cell'
이전 댓글 표시
dear all, I have an problem in terms of mat2cell command...
What i already know is how to deal with specific numbers, say for instance, the code for dividing image I (size 128*128 ) into non-overlapping blocks (size 8*8) is as the following:
c = mat2cell( I, [8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8], ...
[8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8]);
But I really struggled with how to write the code when there is no specific numbers, for example, divide an image I (size 128*128) into non-overlapping blocks (size n*n) , and the total amount of blocks is 128*128/n*n...
Could anyone help..? thx a lot !
채택된 답변
추가 답변 (1개)
Use repmat to build your vector of tile heights or widths.
A = ones(8);
n = 2;
v = repmat(n, 1, 4) % You could compute the 4 for this line
C = mat2cell(A, v, v)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!