MATLAB: How to generate a hankel and toeplitz array of blocks from three series

matrixmatrix arraymatrix manipulation

How to generate a matrix of H and a matrix of T, and my matrix to generate these other two has dimension 3×5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
with the H 4×4 block matrix with columns vectors being
[1 6 11]' [2 7 12]' [3 8 13]' [4 9 14]'
[0 0 0 ]' [1 6 11]' [2 7 12]' [3 8 13]'
[0 0 0 ]' [0 0 0 ]' [1 6 11]' [2 7 12]'
[0 0 0 ]' [0 0 0 ]' [0 0 0 ]' [1 6 11]'
with the T 4×4 block matrix with columns vectors being
[2 7 12]' [3 8 13]' [4 9 14]' [5 10 15]'
[3 8 13]' [4 9 14]' [5 10 15]' [0 0 0 ]'
[4 9 14]' [5 10 15]' [0 0 0 ]' [0 0 0 ]'
[5 10 15]' [0 0 0 ]' [0 0 0 ]' [0 0 0 ]'
Thus, the matrices of H and T have this behavior described in the last two matrices. Thanks any help!
PS:I did a previous post only that I had not considered the block array and Matt J was very kind in helping me, but actually to be able to perform the system ID would have that array of blocks.
In this case as I would for instead of just picking the first row, I get all the row and first column, all rows and second column and so on until the next but last column, in the case of the Toeplitz array
H=hankel(A(1,2:4))
T=triu(toeplitz(A(1,1:3)))

Best Answer

A = [1 2 3 4 5
6 7 8 9 10
11 12 13 14 15 ];
[m,n] = size(A);
C = num2cell(A,1);
ii = triu(toeplitz(1:n-1));
H = repmat({zeros(m,1)},n-1);
lo = triu(true(n-1));
H(lo) = C(ii(lo))
jj = hankel(2:n);
T = repmat({zeros(m,1)},n-1);
lo = jj > 0;
T(lo) = C(jj(lo))