I have a matrix of missing values, and I want to set the upper left portion of that matrix to values in another matrix.
initial_matrix=J(3,3,.);
update_matrix=[1 2, 3 4];
The desired result is
[
1 2 .,
3 4 .,
. . .
]
I know I could iterate on the indices of the matrix like this
for(i=1, i<=N rows(update_matrix), i++,
for(k=1, k<=N cols(update_matrix), k++,
initial_matrix[i,k]=update_matrix[i,k]
)
);
Show(initial_matrix)
but is there an easier more compact way to do this using direct referencing of the matrix indices?