MathGroup Archive 2004

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

Search the Archive

Re: recover a value in module at the end

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51167] Re: recover a value in module at the end
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 7 Oct 2004 05:25:44 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <ck0bta$nuc$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) the construct
 Module[{},
  Table[param1 = Random[];param2=Random[],{i, 1000}]
  ];
  is complete use less because you only need a Module[] if you have local
  variables
b)
   lst= Table[{Random[],Random[]},{1000}]
   will save all the random numbers in lst

Regards
  Jens


"sean kim" <sean_incali at yahoo.com> schrieb im Newsbeitrag 
news:ck0bta$nuc$1 at smc.vnet.net...
> 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
> 



  • Prev by Date: Re: solve and simplify. force left hand side to be 0==
  • Next by Date: Re: recover a value in module at the end
  • Previous by thread: Re: recover a value in module at the end
  • Next by thread: RenderMan RIB bindings