Re: Protected element error
- To: mathgroup at smc.vnet.net
- Subject: [mg17258] Re: Protected element error
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 30 Apr 1999 02:34:43 -0400
- Organization: Universitaet Leipzig
- References: <7g0van$e8n@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Kristen, "ahm -- what is "a33" ? In Mathematica is a String and *not* a symbol If you whant to convert between strings (stupid constructs that hold some characters) and symbols (clever things that have values, function definitions, ..) you have to use ToExpression["A"<>sur<>"x"][1,1] and to get a string from a symbol or expression you may use ToString[]. I don't know the rest of your program but it seems that you have serious problems with the basic ideas of Mathematica. My advice is *not* to add ToExpression[] to your code. You should sit down and read "The Book" very carefuly to understand the difference of symbols and strings. Regards Jens Kristen Rounds wrote: > > 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