Re: problem with Part function
- To: mathgroup at smc.vnet.net
- Subject: [mg18199] Re: [mg18172] problem with Part function
- From: "Wolf, Hartmut" <hwolf at debis.com>
- Date: Mon, 21 Jun 1999 22:50:40 -0400
- Organization: debis Systemhaus
- References: <199906200354.XAA27513@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Dario, Casubolo Dario schrieb: > > Just a little problem: > I've a matrix of zeros, say: > mat=Table[Table[0,{5}],{5}]; > then, I've a point in xy axys, > xy={3,3}; > now, I want the position {3,3} of matrix becomes 1; > if I write > mat[[xy]]=1; or mat[[{3,3}]]=1; it doesn't work; only mat[[3,3]]=1 > works, but I don't want rewrite all. The Mathematica Function for doing what you want is ReplacePart[mat,1,xy] If you want to taste syntactical sugar you have first to convert your "point" object xy to a sequence: mat[[Sequence@@xy]]=1 regards, hw
- References:
- problem with Part function
- From: "Casubolo Dario" <bubbola@workline.it>
- problem with Part function