MathGroup Archive 2005

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

Search the Archive

Re: Saving file problem

  • To: mathgroup at
  • Subject: [mg54579] Re: Saving file problem
  • From: Bill Rowe <readnewsciv at>
  • Date: Wed, 23 Feb 2005 03:11:59 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/22/05 at 4:23 AM, nilaakash at (nilaakash) wrote:

>Here I want to save my file in the following way

>\!\(For[i = 1, i &#8804; 5, t = Table[{i, x, Sin[
>    x\^i]}, {x, \(-2\) &#960;,
>         2  &#960;}]; \[IndentingNewLine]Export["\<tmp.txt\>", 
>              t, "\<Table\>"]; \(i++\)]\)

>But it prints only the last value of i. 

Right. Export over writes any existing file. So, by including the Export inside the For loop, the only value that can appear in the output file is with the last value of i since all previous output will have been over written.

>Please could you tell me how to save all the i values.

Create the complete table then write it to a file.

The code you posted is nearly incomprehensible. So, I cannot determine exactly what you are attempting to do. But I doubt you need a For loop. For example,

  Table[{n, x, Sin[x^n]}, {n,5},{x, -2 Pi, 2 Pi, Pi/4}]//N,

will output all of the values.

If you need separate files, you could do something like

For[n = 1, n < 6,
    Table[{n, x, Sin[x^n]},{x, -2 Pi, 2 Pi, Pi/4}]//N,

To reply via email subtract one hundred and four

  • Prev by Date: Re: pattern matching all list elements but last
  • Next by Date: Re: pattern matching all list elements but last
  • Previous by thread: Saving file problem
  • Next by thread: Saving file problem