I have the following variables:
myMatrix={{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}
myIndices={1,3}
I need to replace the rows myIndices
of myMatrix
with rows that contain a 1
at the position of the row number. The final result should be:
myMatrixFinal={{1,0,0},{0,0,0},{0,0,1},{0,0,0},{0,0,0},{0,0,0}}
How can I do this functionally, without a For loop? Thank you!