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.
Details
- 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,dims]] is the same as Flatten[list].
- In ArrayReshape[list,dims,padding], any padding scheme supported by ArrayPad can be specified. The default padding value is 0.
- ArrayReshape works with SparseArray objects.
Examples
open allclose allBasic Examples (4)
Scope (1)
Generalizations & Extensions (1)
ArrayReshape works with SparseArray objects:
Applications (2)
Properties & Relations (2)
A function based on Partition equivalent to ArrayReshape without padding:
Reversing matrix dimensions does not give the same element order as Transpose:
Text
Wolfram Research (2012), ArrayReshape, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayReshape.html.
CMS
Wolfram Language. 2012. "ArrayReshape." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ArrayReshape.html.
APA
Wolfram Language. (2012). ArrayReshape. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayReshape.html