ReplacePart position
- To: mathgroup at smc.vnet.net
- Subject: [mg52551] ReplacePart position
- From: "Bas Straatman" <g15bs at morgan.ucs.mun.ca>
- Date: Wed, 1 Dec 2004 05:59:05 -0500 (EST)
- Organization: Memorial University of Newfoundland
- Sender: owner-wri-mathgroup at wolfram.com
Hello-- Half way through my simulations I run into the following problem. The model generates a list and when I try to replace parts of that list it does fine in most cases. However, there is a position in the list that does not exist according to ReplacePart. For example: newes1[[11, 4, 1, 2, 3]] 18 Part[newes1, 11, 4, 1, 2, 3] 18 Position[newes1, 18] {{11, 4, 1, 2, 3}} ReplacePart[newes1, 19, {11, 4, 1, 2, 3}] ReplacePart :: partw : Part {11, 4, 1, 2, 3} of ..... does not exist. newes1 is the list of lists (5 levels) mentioned above. I can understand it would be helpful to actually have that list here, but it is too long to include. Furthermore it wouldn't help, because when I close the Kernel and define the list exactly as newes1 is at this moment, and replace the part as above it works fine. I can even copy the part of the output after the error message and execute it and no problem, the part is there. FullForm doesn't give me any new insights, the list is there and nothing seems to be wrong. Same for Trace, the whole list is there, but ReplacePart cannot replace the element at above mentioned position. Strangely enough the following does work: Part[newes1, 11, 4, 1, 2, 3] = 19 19 Part[newes1, 11, 4, 1, 2, 3] 19 Does anyone know where I can find an explanation for this? Thanks. Bas Straatman
- Follow-Ups:
- Re: ReplacePart position
- From: yehuda ben-shimol <benshimo@bgu.ac.il>
- Re: ReplacePart position