


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

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