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

PadRight

PadRight
makes a list of length n by padding list with zeros on the right.
PadRight
pads by repeating the element x.
PadRight
pads by cyclically repeating the elements .
PadRight
leaves a margin of m elements of padding on the left.
PadRight
makes a nested list with length at level i.
PadRight[list]
pads a ragged array list with zeros to make it full.
  • PadRight always returns a list of length n, except in some special cases where padding is .
  • With padding cyclic repetitions of the are effectively laid down and then the list is superimposed on top of them, with the first element of the list lying on an occurrence of . »
  • A margin of Round[(n-Length[list])/2] effectively centers list.
  • PadRight effectively treats list as cyclic.
  • PadRight can be used to repeat an individual element that is itself a list.
  • PadRight repeats the sequence of as many times as fits in a list of length n.
  • PadRight creates a full array with dimensions even if list is ragged. »
  • Negative specify to pad on the left.
  • PadRight pads by repeating the block of .
  • PadRight effectively treats list as cyclic in every dimension.
  • The object list need not have head List.
Pad with to make the list be of length 10:
Pad with :
Pad by repeating :
Leave margin on the left:
Pad to make a × array:
Pad to make a full array:
Pad with to make the list be of length 10:
In[1]:=
Click for copyable input
Out[1]=
 
Pad with :
In[1]:=
Click for copyable input
Out[1]=
 
Pad by repeating :
In[1]:=
Click for copyable input
Out[1]=
 
Leave margin on the left:
In[1]:=
Click for copyable input
Out[1]=
 
Pad to make a × array:
In[1]:=
Click for copyable input
Out[1]//TableForm=
 
Pad to make a full array:
In[1]:=
Click for copyable input
Out[1]//TableForm=
Negative length specifications pad on the left:
Lay down repetitions of the padding, then superimpose the original array:
Use different margins for rows and columns:
Use a head other than List:
Put a 1 at the center of a list of 0s:
Lay out an array of tiles:
PadLeft and PadRight pad to make a list of length n:
ArrayPad pads with n additional elements on each side:
Pad with an element that is itself a list:
New in 4 | Last modified in 6