Re: help save matrix inside a Loop
- To: mathgroup at smc.vnet.net
- Subject: [mg49588] Re: [mg49553] help save matrix inside a Loop
- From: Yasvir Tesiram <yat at omrf.ouhsc.edu>
- Date: Sat, 24 Jul 2004 03:47:18 -0400 (EDT)
- References: <200407230959.FAA20390@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, 1. Initialize a vector to hold the results of each iteration. Use AppendTo to stuff the results into the vector. Then export. Depending on the size of the results this may not be an optimal solution. 2. Alternatively create a list of filenames and tag the Put or Export operation to the counter. e.g. filenames = {a, b, c, d, e}; For[i = 1, i <= Length[filenames], i++, result = i + 1; Export["~/Desktop/" <> ToString[filenames[[i]]] <> ".txt", result, "List"]] There are probably umpteen methods to do this without a For loop. Cheers Yas On Jul 23, 2004, at 4:59 AM, paolo wrote: > I am generating scenarios of interest rate. Any scenarios is a matrix > [[n,m]]. > to generate multiple scenarios i use a loop "For[ ]". I need to save > any matrix > generated in a file txt. > > How can i include the save command > > MatrixName >> ".././.nameFile.txt" > > inside the loop > > For [ ................] > > to save all the matrix in different files????? i.e. if the Loop have > 50 steps i > wish to create 50 file txt each of one is a different scenario. > > The (obvious) problem that i am encoutering is that for any step of > the Loop the > new matrix created will overwrite the previous matrix so at the end of > the Loop > i can "Load" only the file of the last scenario generated! > > Thanks > > Paolo
- References:
- help save matrix inside a Loop
- From: "paolo " <tarpanelli@libero.it>
- help save matrix inside a Loop