Hello,
Let's say A is a 10x10x4 matrix. A(1,1,:) = a,b,c,d
I want to convert A to B a 20×20 matrix so that: B (1:2,1:2) = [a b;c d];
Is there an efficient way to create the B matrix without using loops?
Cheers!
Edit1: I wrote A as a 10x10x4 matrix, although in reality the matrix's size is around 20 000 x 20 000 x 4.
Edit 2: I reformulated the question:
- A is a huge M x N x 4 matrix
Example:
A = zeros(M,N,4);A(1,1,:) = [1 1 2 2]; A(2,1,:) = [3 3 4 4];A(1,2,:) = [5 5 6 6];A(2,2,:) = [7 7 8 8];
2. Convert A to a regular 2*M x 2*N matrix so that:
Example:
%Desired output:
B = 1 1 5 5 . .2 2 6 6 . .3 3 7 7 . .4 4 8 8 . .. . . .. . . .
Best Answer