CenterArray
CenterArray[a,n]
creates a list of length n with the elements of a at the center and zeros elsewhere.
CenterArray[a,{n1,n2,…}]
creates an n1×n2×… array with the array a at the center and zeros elsewhere.
CenterArray[a,nspec,pad]
uses pad instead of zero for the background.
CenterArray[nspec]
creates an array with a single 1 at the center and zeros elsewhere.
Details
- The input a can be a list, full array, ragged array, or any form of array, such as a SparseArray object.
- CenterArray always generates a full array.
- CenterArray[a,nspec,pad,SparseArray] creates a SparseArray object.
- CenterArray[expr,…] is equivalent to CenterArray[{expr},…] if expr is not a list.
- CenterArray[a,n] attempts if possible to put equal padding on both sides of a. If this is not possible, additional padding is placed on the right.
- In the form CenterArray[a,{n1,n2,…}], any of the ni can be Inherited, in which case it is assumed to be the corresponding dimension of a, and no padding is added at this level.
- If the resulting array has a higher rank, a is centered at the deepest level.
- For possible settings of padding value pad, see the reference page for ArrayPad.
Examples
open allclose allBasic Examples (3)
Scope (11)
Data (9)
Applications (6)
Conform a list of arrays so they have commensurate dimensions:
Conform elements of a list so they are all of length 3:
Apply a dimension-sensitive operator to the conformed elements:
Make a full array from a ragged list of full arrays:
Create a sharpening kernel from a lowpass kernel:
Sharpen an image by convolving with the computed kernel:
Show a collection of graphs with missing graphics:
By default, GraphicsGrid has empty spaces at the ends:
Properties & Relations (3)
Possible Issues (2)
Text
Wolfram Research (2016), CenterArray, Wolfram Language function, https://reference.wolfram.com/language/ref/CenterArray.html.
CMS
Wolfram Language. 2016. "CenterArray." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CenterArray.html.
APA
Wolfram Language. (2016). CenterArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CenterArray.html