REPMAT Name
REPMAT Purpose
This program replicates a matrix or array in the style of
the MATLAB RebMat command. The matrix or array is "tiled"
in some integer number of columns and rows.
Author
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
Category
Utilities Calling Sequence
tiledMatrix = RepMat(matrix, ncol, nrow)
Auguments
matix: The matrix or array to be tiled.
ncol: The number of columns in the tile.
nrow: The number of rows in the tile.
Return Value
tiledMatrix: If (xdim,ydim) is the size of the original 2D matrix, then the
output matrix is sized (ncol*xdim, nrow*ydim).
Keywords
None.
Example
IDL> matrix = Reform(Indgen(6) + 1, 3, 2)
IDL> Print, matrix, FORMAT='(3I3)'
1 2 3
4 5 6
IDL> Print, RepMat(matrix, 3, 2), FORMAT='(9I3)'
1 2 3 1 2 3 1 2 3
4 5 6 4 5 6 4 5 6
1 2 3 1 2 3 1 2 3
4 5 6 4 5 6 4 5 6
Modification History
Written by David W. Fanning, 8 May 2009.
Algorithm significantly improved by Ronn Kling, 4 August 2009.
Added line to handle an input matrix with a trailing 1 dimension correctly. DJ 8 March 2011.