Re: silly problem
- To: mathgroup at smc.vnet.net
- Subject: [mg85301] Re: silly problem
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 5 Feb 2008 19:39:33 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <fo9g1h$sbm$1@smc.vnet.net>
Francis Bitonti wrote:
> I'm new to Mathematica so this is a very basic question I think. but one
> that has me hung up. I keep getting this error
>
> Set::write: Tag List in {0,0,0,0,0,0,0,0}[1] is Protected. >>
>
>
> my code looks like this.
>
> *IN:*
> For[i = 1, i < 6 , i++,
> Print[
> g = i;
> k[g] = twoDcalc[e1, a1, nodes[[{edges[[g, 1]], edges[[g, 2]]}]]]]]
The following should work as expected:
k[[g]] = twoDcalc[e1, a1, nodes[[{edges[[g, 1]], edges[[g, 2]]}]]]]]
From what I could infer form the code you posted, the array 'k' was
defined as a list of values. In this case one must use the *Part*
function (or [[...]]) to read or modify the value at a specific location
or index. See http://reference.wolfram.com/mathematica/ref/Part.html
Regards,
--
Jean-Marc