This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ArrayPad

ArrayPad
gives an array with m 0s of padding on every side.
ArrayPad
uses the specified padding.
ArrayPad
pads with m elements at the beginning and n elements at the end.
ArrayPad
pads with , elements at level i in array.
  • The following forms of padding can be specified:
ca constant c
{c1,c2,...}cyclic repetition of constants
"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 indicates that the elements added at each corner should be copies of the elements at the corners of the original array.
  • indicates that the outermost elements in the array should be repeated as the innermost elements in the padding. specifies that these elements should not be repeated.
  • With the padding value , the degree of polynomial used is specified by the option InterpolationOrder.
  • ArrayPad pads full arrays of any depth.
  • ArrayPad removes m elements from each side of array.
Pad the edges of a list with 0s:
Pad the edges of a matrix:
Specify different padding on each side:
Pad with any expression:
Pad according to a named rule:
Pad the edges of a list with 0s:
In[1]:=
Click for copyable input
Out[1]=
 
Pad the edges of a matrix:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
 
Specify different padding on each side:
In[1]:=
Click for copyable input
Out[1]=
 
Pad with any expression:
In[1]:=
Click for copyable input
Out[1]=
 
Pad according to a named rule:
In[1]:=
Click for copyable input
Out[1]=
Pad only on the right:
Remove elements from each edge of an array:
Pad with extra rows:
Pad with extra columns:
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:
Pad using extrapolation of different orders:
Pad using the maximal extrapolation order:
Specify the order of interpolation for padding:
By default linear interpolation is used:
Use the maximum possible order, in this case order 3:
Lay out tiles by reflecting about their edges:
PadLeft and PadRight pad to make a list of length n:
ArrayPad pads with n additional elements on each side:
ArrayPad is effectively Drop for a one-dimensional list:
ArrayPad is effectively Drop:
A single number or pair of numbers is interpreted to apply in each dimension:
Explicitly specify the padding amount in each dimension:
Normally even empty array dimensions are padded:
With padding types that depend on array values, only nonempty array dimensions are padded:
Visualize the different named padding rules:
New in 7