i have matrix of 256*256 n i want to extract first 4*4 matrix of every 8*8 blocks of 256*256 matrix

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 3월 28일
편집: Azzi Abdelmalek 2014년 3월 29일

1 개 추천

Edit
A=rand(256) % Example
idx=1:8:256
[jj,ii]=meshgrid(idx,idx)
B=cell2mat(arrayfun(@(ii,jj) A(ii:ii+3,jj:jj+3),ii,jj,'un',0))

댓글 수: 8

Jitesh Bhanushali
Jitesh Bhanushali 2014년 3월 28일
but i have matrix of 256*256 n i want to extract first 4*4 matrix of every 8*8 blocks of 256*256 matrix
Azzi Abdelmalek
Azzi Abdelmalek 2014년 3월 28일
This is another question, please edit your question
A=rand(256) % Example
idx=1:8:256
[jj,ii]=meshgrid(idx,idx)
B=arrayfun(@(ii,jj) A(ii:ii+3,jj:jj+3),ii,jj,'un',0)
Jitesh Bhanushali
Jitesh Bhanushali 2014년 3월 28일
not returning value of 4*4 matrix
B is a cell array containing all 4x4 arrays. Type
celldisp(B)
Jitesh Bhanushali
Jitesh Bhanushali 2014년 3월 29일
sir how to store that celldisp(B)...
Jitesh Bhanushali
Jitesh Bhanushali 2014년 3월 29일
i want to join that 4*4 matrix into a sigle matrix
cell2mat(B)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2014년 3월 28일

편집:

2014년 3월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by