Learn R Programming

matlab2r (version 1.5.0)

repmat: Repeat matrix

Description

Repeats a matrix over n columns and rows

Usage

repmat(mx, n)

Value

matrix replicated over ncol(mx) * n columns and nrow(mx) * n rows

Arguments

mx

matrix

n

either a scalar with the number of replications in both rows and columns or a <= 3-length vector with individual repetitions.

Details

This function was created to replicate the behavior of a homonymous function on Matlab

Examples

Run this code
x <- matrix(1:4, 2)
repmat(x, 1)
repmat(x, 2)
repmat(x, c(2, 3))

Run the code above in your browser using DataLab