ConstantArray

ConstantArray[c,n]

generates a list of n copies of the element c.

ConstantArray[c,{n1,n2,}]

generates an array of nested lists containing copies of the element c.

Details

Examples

open allclose all

Basic Examples  (3)

Make a vector of 10 c's:

In[1]:=
Click for copyable input
Out[1]=

Make a 3×4 array of c's:

In[1]:=
Click for copyable input
Out[1]=

Make an array out of blocks:

In[1]:=
Click for copyable input
Out[1]=

Scope  (4)

Applications  (3)

Properties & Relations  (3)

See Also

Array  Table  Range  SparseArray  IdentityMatrix  UnitVector  ConstantImage  ArrayFlatten  StringRepeat

Introduced in 2007
(6.0)
| Updated in 2008
(7.0)