I have a matrix of size 256*384. If we divide it into 4*4 blocks there will be total of 6144 sub matrices(4*4 size). If we divide it into 2*2 blocks there will be total of 24576 sub matrices(2*2 size). I have to get the first value of each sub matrix( (1,1) value of each sub matrix) into single matrix, second value ( (1,2) value ) of each sub matrix into other single matrix and so on upto last value of each sub matrix( (2,2) value for 2*2 sub matrix and (4,4) value for 4*4 sub matrix ) into single matrix. Example: A=[5 4 1 2;9 5 7 3;1 3 8 5;6 0 4 1]; (4*4 size) Divided into 2*2 submatrices The output should be as follows: B(1)=[5 1;1 8] (All first values of each 2*2 submatrix into one matrix) B(2)=[4 2;3 5] (All second values of each 2*2 submatrix into one matrix) B(3)=[9 7;6 4] (All third values of each 2*2 submatrix into one matrix) B(4)=[5 3;0 1] (All fourth values of each 2*2 submatrix into one matrix) and so on upto last value of each submatrix for large matrix.
MATLAB: How to assign values of each sub matrix from main matriix into another matrix
image processingmatrix manipulationsliding window
Related Question
- How to build a new matrix
- Is it possible to extract the values with a vector of indices for each row without using the for statement from the matrix
- How could I randomly split the columns of a matrix into 3 matrices with equal number of columns
- Creating a submatrix from a matrix
- How to filter rows with respect to specific entry
Best Answer