Re: Protected element error
- To: mathgroup at smc.vnet.net
- Subject: [mg17269] Re: Protected element error
- From: "David Keith" <dkeith at sarif.com>
- Date: Fri, 30 Apr 1999 02:34:49 -0400
- Organization: Hevanet Communications
- References: <7g0van$e8n@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kristen, In "A"<>sur<>"x"[1,1]=Input["New a33 x value"]]; the left hand side is a string, not a symbol. As written it has Head StringJoin and you can't assign a value to that. Symbol[] turns a string into a symbol, but to use it on the left side you need to let Mathematica evaluate the left side by using Release[]. Try assigning this way: Release[Symbol["A"<>sur<>"x"] [[1,1]] ] = Input["New a33 x value"]]; This group has far better programmers than I, so you may well get a better answer. Regards, Kristen Rounds wrote in message <7g0van$e8n at smc.vnet.net>... >Early in my program I define a 4x4 matrix: > >A1x:=M.b1x.Transpose[M]; > >Later I wish to allow the user to modify a matrix element: > >If[StringMatchQ[terma,"a33",IgnoreCase->True], >"A"<>sur<>"x"[1,1]=Input["New a33 x value"]]; > >I am getting this error when I try to use the new A1x matrix: > >SetDelayed::write: Tag StringJoin in A<>1<>x is Protected. > >I tried to use Unprotect[A1x]; prior to the new input, but that >doesn't seem to make a difference. > >Please explain this error, and if there is a way to avoid it. Thanks. > >Kristen > > >