Skip to content

reshape

Reshape array

reshape(A, [s1, s2, ..., sn])

  • A should be an array and s1, s2, ..., sn with n ≥ 2 specify the desired size vector of the output.
  • If sz represents the size vector in the second input argument, A should have prod(sz) elements.

reshape(A, s1, s2, ..., sn)

reshape(A, s1, s2, [ ], ..., sn)

  • s1, s2, ..., sn are positive integers defining the desired size of the output.
  • If one of them is given as [], the size of the corresponding dimension will be calculated automatically to fit the number of elements of A.
  • It should have no more than one [] as its argument.