extract matrix from matrix

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

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 28 Mar 2014
Edited: Azzi Abdelmalek on 29 Mar 2014
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 Comments

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
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)
not returning value of 4*4 matrix
B is a cell array containing all 4x4 arrays. Type
celldisp(B)
sir how to store that celldisp(B)...
i want to join that 4*4 matrix into a sigle matrix

Sign in to comment.

Categories

Asked:

on 28 Mar 2014

Edited:

on 29 Mar 2014

Community Treasure Hunt

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

Start Hunting!