I make a list of 5 empty $3 \times 3$ matrices via
Table[m[i]=IdentityMatrix[3]-IdentityMatrix[3],{i,1,5}]
However when I want to change an entry via
m[2][[3,4]]=5
I get an error which reads:
Set::setps: m[2] in the part assignment is not a symbol. >>
Any ideas? Thanks
m = ConstantArray[0, {5, 3, 3}]
and then dom[[2, 3, 4]] = 1
? $\endgroup$m[2]
is not a symbol itself, but a reference to one of theDownValue
s of the symbolm
, this is what you get. $\endgroup$Do
andTable
, we don't useTable
just for side effects ;) $\endgroup$m[2] = ReplacePart[m[2], {3, 4} -> 5]
but that copies the whole ofm[2]
so I would prefer @J.M. 's suggestion. $\endgroup$