Re: how to save each raw of data to separate file?

• To: mathgroup at smc.vnet.net
• Subject: [mg80334] Re: how to save each raw of data to separate file?
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sat, 18 Aug 2007 05:29:36 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <fa3dp9\$v9\$1@smc.vnet.net>

```Arkadiusz.Majka at gmail.com wrote:

> Say I have a list of sublists
> b= {{a1,a2,a3},{b1,b2},{c1,c2,c3,c4}}
>
> How can I automatically save b[[1]], b[[2]] and b[[3]] to three
> separate files?
>
> How should I correct the below expression to let it work?
>
> Table[b[[i]]>>i, {i,1,Length[b]}]

You can use (at least) *Table*, *Do*, *Map*, or *Scan* with the full
form of >> that is *Put*. (Note that *Do* or *Scan* should be preferred
since your are not interested in the resulting list that is built by
*Table* or *Map*.)

In[1]:= b = {{a1, a2, a3}, {b1, b2}, {c1, c2, c3, c4}};

In[2]:= Table[Put[b[[i]], ToString@i], {i, 1, Length[b]}]

Out[2]= {Null, Null, Null}

In[3]:= Do[Put[b[[i]], ToString@i], {i, 1, Length[b]}]

In[4]:= Put[b[[#]], ToString@#] & /@ Range@Length[b]

Out[4]= {Null, Null, Null}

In[5]:= Scan[Put[b[[#]], ToString@#] &, Range@Length[b]]

In[6]:= \$Version

Out[6]= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

--
Jean-Marc

```

• Prev by Date: Re: Mathematica 6
• Next by Date: Re: Mathematica 6.0 bug in computing MathieuC
• Previous by thread: Re: how to save each raw of data to separate file?
• Next by thread: Graphics output in Mathematica 6 functions ?