Re: recover a value in module at the end
- To: mathgroup at smc.vnet.net
- Subject: [mg51183] Re: [mg51151] recover a value in module at the end
- From: DrBob <drbob at bigfoot.com>
- Date: Thu, 7 Oct 2004 05:26:15 -0400 (EDT)
- References: <200410060834.EAA24230@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
Try a variation on: First@Last@Reap@Module[{param1, param2}, Do[param1 = Random[]; param2 = Random[]; Sow@{param1, param2}, {i, 10}]] or Last@Reap[ Module[{param1, param2}, Do[param1 = Random[]; param2 = Random[]; Sow[param1, "param1"]; Sow[param2, "param2"], {i, 10}]], _, List] or Last@Reap[ Module[{param1, param2}, Do[param1 = Random[]; param2 = Random[]; Sow[param1, "param1"]; Sow[param2, "param2"], {i, 10}]], "param1", List] Bobby On Wed, 6 Oct 2004 04:34:37 -0400 (EDT), sean kim <sean_incali at yahoo.com> wrote: > > > Hello Group, > > let's say you have a module that repeats many times. > and let's say you want to keep parameter(s) to memory > or output so that you can recover them at the end. > > for instance, > > > Module[{}, > Table[param1 = Random[];param2=Random[],{i, 1000}] > ]; > > > if I go > In[51]:= param1 > param2 > > Out[51]= 0.43482 > Out[52]= 0.0305665 > > it only recovers the last number the module used. > > I can do, > > In[59]:= Module[{}, > Table[{param1=Random[];param2=Random[]}; > param1>>>param1.txt > ,{i,1000}]]; > l1 = Import["param1.txt","List"]; > Length[l1] > > Out[61]= 4000 > > but the above will not overwrite the values from > previous iteration as shown by the length. ( i > repeated it 4 times) > > what do I do if I want to over write the values from > previous iteration and form a new output file > everytime a Module is run? > > > thanks in advance for any insights. > > sean > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- recover a value in module at the end
- From: sean kim <sean_incali@yahoo.com>
- recover a value in module at the end