MATLAB: How do i place a matrix on top of each other using repmat

MATLABmatrixrepmat

I have 3 matrix's. Matrix Z1 with 5 rows and 5 columns of zeros, matrix Z2 with 5 rows and 10 columns of ones. And, matrix Z3 with 3 identical rows, each row containing the integers from 0 to 14. My aim is to have a matrix z that z1 and z2 will be tiles on top of matrix z3. I tried to combine both z1 and z2 into a matrix x then using repmat comand to put z3 matrix as the bottom tile. I don't know if im using the wrong command even.
The exspected output is this:
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Any help is appriciated!! 🙂

Best Answer

z1=zeros(5);
z2=ones(5,10);
z3=repmat(0:14,5,1); % proper usage
Result=[z1 z2;z3] % concatenate z1 , z2 horizontally & z3 vertically.