MATLAB: Looping for replace matrix elements

manipulation indexmatrix

Helo,
I have matrix 3×3, let's say
XX = [3,0,0;
0,3,3;
4,5,4]
I want to generate matrix 9×3 which value same with matrix XX every forth row. as illustration:
XXnew = zeros (9,3)
as result :
XXnew = [3,0,0;
0,3,3;
4,5,4;
3,0,0;
0,3,3;
4,5,4;
3,0,0;
0,3,3;
4,5,4];
How to code with "for end" function.
Thank you!

Best Answer

XX = [3,0,0;0,3,3;4,5,4] ;
iwant = repmat(XX,3,1);
doc repmat.