My R code has the line
assign("matr",matr[-i], envir=.GlobalEnv)
and runs perfectly fine.
Note that
matr <-- m