MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

ReplacePart position

  • To: mathgroup at
  • Subject: [mg52551] ReplacePart position
  • From: "Bas Straatman" <g15bs at>
  • Date: Wed, 1 Dec 2004 05:59:05 -0500 (EST)
  • Organization: Memorial University of Newfoundland
  • Sender: owner-wri-mathgroup at


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]]


Part[newes1, 11, 4, 1, 2, 3]


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


Part[newes1, 11, 4, 1, 2, 3]


Does anyone know where I can find an explanation for this? Thanks.

Bas Straatman

  • Prev by Date: GUIKit and VisibleRect
  • Next by Date: Re: launching a kernel on a remote linux machine through ssh from a linux machine
  • Previous by thread: Re: GUIKit and VisibleRect
  • Next by thread: Re: ReplacePart position