MATLAB: Creating a Matrix including ones on diagonal

matrix array

How can I create a matrix with the most shortcut way such as:
1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
Thank you

Best Answer

kron(eye(4),ones(1,5))
Related Question