Learn R Programming

pracma (version 1.5.8)

repmat: Replicate Matrix

Description

Replicate and tile matrix.

Usage

repmat(a, n, m = n)

Arguments

a
vector or matrix to be replicated.
n, m
number of times to replicate in each dimension.

Value

  • Returns matrix with value a replicated to the number of times in each dimension specified. Defaults to square if dimension argument resolves to a single value.

Details

repmat(a,m,n) creates a large matrix consisting of an m-by-n tiling of copies of a.

See Also

Reshape

Examples

Run this code
repmat(1, 3)                  # same as ones(3)
repmat(1, 3, 3)
repmat(matrix(1:4, 2, 2), 3)

Run the code above in your browser using DataLab