Is there a simple command for repeating matrix-like elements within a matrix without using a loop? For example, say I have a matrix such as
>> A = [1,2,5,6;3,4,7,8;9,10,13,14;11,12,15,16]A = 1 2 5 6 3 4 7 8 9 10 13 14 11 12 15 16
I want to scale this matrix, such that it becomes
>> B = [1,2,1,2,5,6,5,6;3,4,3,4,7,8,7,8;1,2,1,2,5,6,5,6;3,4,3,4,7,8,7,8;9,10,9,10,13,14,13,14;11,12,11,12,15,16,15,16;9,10,9,10,13,14,13,14;11,12,11,12,15,16,15,16]B = 1 2 1 2 5 6 5 6 3 4 3 4 7 8 7 8 1 2 1 2 5 6 5 6 3 4 3 4 7 8 7 8 9 10 9 10 13 14 13 14 11 12 11 12 15 16 15 16 9 10 9 10 13 14 13 14 11 12 11 12 15 16 15 16
I'm simply looking for a command or a combination of such to create this matrix.
Best Answer