let 1st dimension n1, n2, n3 and n4, the 1st dimension (rows), the 2nd dimension (columns), the 3rd and the 4th dimension respectively of your 4D-array.
A(n1, n2, n3, n4) = a, where: "a" can be a scalar or a vector or a matrix with: size(a) = (length(n1), length(n2)), and: n1, n2 are integers or vectors of integers and n3 and n4 are integers.
The resulting 4D-array will contain (n3 X n4) matrices of size
(max(n1), max(n2)).
For more explanation, try to execute the following example:
To extend the rows, columns, or pages of an array, use similar assignment statements. The dimensions of arrays on the right side and the left side of the assignment must be the same.
Extend A into a 3-by-3-by-3-by-2, four-dimensional array. In the first assignment, MATLAB pads A to fill the unassigned elements in the extended dimension with zeros. The second and third assignments replace the zeros with the specified values.