Re: Show doesn't work inside Do loop ?
- To: mathgroup at smc.vnet.net
- Subject: [mg101931] Re: Show doesn't work inside Do loop ?
- From: pfalloon <pfalloon at gmail.com>
- Date: Thu, 23 Jul 2009 03:56:25 -0400 (EDT)
- References: <h46p3c$e4k$1@smc.vnet.net>
On Jul 22, 8:19 pm, "ibmich... at hotmail.com" <ibmich... at hotmail.com> wrote: > Hi, > > Is there a way to use Show inside a Do loop? For example, the > following doesn't work: > > Do[ > Print["i =",i]; > Fig = Plot[Sin[i*x], {x, -5, 5}]; > Show[Fig] > , {i, 1, 5}] > > I would like to print different info at each step of the loop, > therefore saving all Fig in a Table or Array doesn't help me. > > Thanks, > > Michuco You could use Print[Fig] instead of Show[Fig]. The Show function is used combine or modify graphics objects, but it still just returns a graphics object. Thus it doesn't do what you want from inside the Do loop. Cheers, Peter.