ArrayReshape

ArrayReshape[list, dims]
arranges the elements of list into a rectangular array with dimensions dims.

ArrayReshape[list, dims, padding]
uses the specified padding if list does not contain enough elements.

DetailsDetails

  • ArrayReshape always gives a rectangular array of the specified dimensions, ignoring the last elements or adding new elements as necessary.
  • Elements are arranged in the resulting array so that up to length, Flatten[ArrayReshape[list]] is the same as Flatten[list].
  • All the forms of padding accepted by ArrayPad can be specified. The default padding value is .
  • ArrayReshape works with SparseArray objects.
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »