I believe the issue is that you are trying to assign a 2-row array into a single row of H. Hence, the dimension mismatch error. If your intent is to assign the array to 2 rows of H, then your row index must include both rows.
% Assignment to 2 rows works
A(1:2,:)=rand(2,6)
% Assignment to 1 row doesn't work
A(3,:)=rand(2,6)