MATLAB: How to repeat columns in matrix in matlab R2014b

columnsMATLABrepeat

I want to make copies for the columns for example i want to repeat the columns 4 times
A=[0 1 2
0 1 2
0 1 2]
A_new= [0 0 0 0 1 1 1 1 2 2 2 2
0 0 0 0 1 1 1 1 2 2 2 2
0 0 0 0 0 0 0 0 2 2 2 2 ]

Best Answer

A_new=kron(A,[1,1,1,1])