ArrayPad
ArrayPad[array,m]
gives an array with m zeros of padding on every side.
ArrayPad[array,m,padding]
uses the specified padding.
ArrayPad[array,{m,n},…]
pads with m elements at the beginning and n elements at the end.
ArrayPad[array,{{m1,n1},{m2,n2},…},…]
pads with mi, ni elements at level i in array.
Details and Options
- The following forms of padding can be specified:
-
c a constant c {c1,c2,…} cyclic repetition of constants c1,… "Extrapolated" polynomial extrapolation of elements "Fixed" repetitions of the elements on each boundary "Periodic" cyclic repetitions of the complete array "Reflected" reflections of the array in the boundary "ReflectedDifferences" reflections of the differences between elements "Reversed" reversals of the complete array "ReversedDifferences" reversals of the differences between elements "ReversedNegation" negated reversals of the array - The padding value "Fixed" indicates that the elements added at each corner should be copies of the elements at the corners of the original array.
- "Reversed" indicates that the outermost elements in the array should be repeated as the innermost elements in the padding. "Reflected" specifies that these elements should not be repeated.
- With the padding value "Extrapolated", the degree of polynomial used is specified by the option InterpolationOrder.
- ArrayPad pads full arrays of any depth.
- ArrayPad works with SparseArray objects.
- ArrayPad[array,-m] removes m elements from each side of array.
Examples
open allclose allBasic Examples (6)
Scope (12)
Remove elements from each edge of an array:
Specify different padding for each edge:
Pad only the first level of an array:
Pad by repeating periodically:
Pad with the reversal of the list:
Pad with the negative of the reversal:
Pad by reflecting about the edge:
Pad antisymmetrically about the value at the edge:
Pad antisymmetrically about the edge of the array with reversed differences:
The differences are reflected about the edge of the original array:
Pad using linear extrapolation:
Generalizations & Extensions (1)
ArrayPad works with SparseArray objects:
Options (3)
Properties & Relations (2)
Possible Issues (2)
Text
Wolfram Research (2008), ArrayPad, Wolfram Language function, https://reference.wolfram.com/language/ref/ArrayPad.html.
CMS
Wolfram Language. 2008. "ArrayPad." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ArrayPad.html.
APA
Wolfram Language. (2008). ArrayPad. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayPad.html