reshape
B = reshape(A,sz1,...,szN)- Reshapes A into an sz1-by-…-by-szN array B, where sz1, …, szN gives the size of each dimension
- A and B must agree on the linear-index ordering of their elements
- Equivalently,
A(:)=B(:) - Naturally,
numel(A)=numel(B)
- Equivalently,
- You can specify a single dimension size as
[]to have it computed automatically so the element count of B matches that of A- For example, if A is a 10-by-10 matrix, then
reshape(A,2,2,[])reshapes the 100 elements of A into a 2-by-2-by-25 array
- For example, if A is a 10-by-10 matrix, then