ArrayPad

ArrayPad[array, m]
gives an array with m 0s 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 , elements at level i in array.

Details and OptionsDetails and Options

  • 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 works with SparseArray objects.
  • ArrayPad[array, -m] removes m elements from each side of array.
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »