


matrixDuplicate: Matrix duplication
Usage: out = matrixDuplicate(mat, p, q)
matrixDuplicate(mat, p, q) returns a big matrix containing p X q mat.
For example:
a = [1 2; 3 4];
matrixDuplicate(a, 3, 4)
ans =
1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4
1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4
1 2 1 2 1 2 1 2
3 4 3 4 3 4 3 4
See also elementDuplicate.

0001 function out = matrixDuplicate(mat, p, q) 0002 %matrixDuplicate: Matrix duplication 0003 % Usage: out = matrixDuplicate(mat, p, q) 0004 % 0005 % matrixDuplicate(mat, p, q) returns a big matrix containing p X q mat. 0006 % 0007 % For example: 0008 % 0009 % a = [1 2; 3 4]; 0010 % matrixDuplicate(a, 3, 4) 0011 % 0012 % ans = 0013 % 0014 % 1 2 1 2 1 2 1 2 0015 % 3 4 3 4 3 4 3 4 0016 % 1 2 1 2 1 2 1 2 0017 % 3 4 3 4 3 4 3 4 0018 % 1 2 1 2 1 2 1 2 0019 % 3 4 3 4 3 4 3 4 0020 % 0021 % See also elementDuplicate. 0022 0023 % Roger Jang, 1995 0024 0025 out = mat((1:size(mat, 1))'*ones(1,p), (1:size(mat,2))'*ones(1,q));