REPEAT Function

REPEAT( matrix, nrow, ncol ) ;

The REPEAT function creates a matrix of repeated values.

The arguments to the REPEAT function are as follows:

matrix

is a numeric matrix or literal.

nrow

gives the number of times matrix is repeated down rows.

ncol

gives the number of times matrix is repeated across columns.

The REPEAT function creates a new matrix by repeating the values of the argument matrix nrow*ncol times, ncol times across the rows, and nrow times down the columns. The matrix argument can be numeric or character. For example, the following statements result in the matrix , repeating the matrix twice down and three times across:

   x={ 1 2 ,
     3 4} ;
   y=repeat(x,2,3);

     Y
     1         2         1         2         1         2
     3         4         3         4         3         4
     1         2         1         2         1         2
     3         4         3         4         3         4