MathGroup Archive 2003

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

Search the Archive

Re: export some data to a specified file?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39745] Re: [mg39685] export some data to a specified file?
  • From: Dale Horton <daleh at wolfram.com>
  • Date: Wed, 5 Mar 2003 00:05:03 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

At 09:04 PM 3/1/2003, liwen liwen wrote:

>Hi;
>
>I want to export some data to a specified file, for instance,
>Spring.txt, I use 'FileName ' as the local file name.
>     But the function I develop only export the data to a file named
>'FileName'but not Spring.txt.
>     How can I achieve this?
>
>       Thanks.
>     Liwen
>
>
>ExportDatas[FileName_,DataToBeExport_]:=Module[{},
>       (DataToBeExport>>FileName);];
>
>In[13]:=
>DataToBeExport={{0,0},{5,4}};
>ExportDatas[Spring.txt,DataToBeExport]

The >> is parsed in a special way. To allow people to use it without 
quoting the filename, the filename isn't evaluated but turned directly into 
a string. To avoid that behavior, you can use the FullForm of the same command.

ExportDatas[FileName_,DataToBeExport_] :=
Put[DataToBeExport, FileName]

DataToBeExport={{0,0},{5,4}};
ExportDatas["Spring.txt",DataToBeExport]

Or you could just use Export

Export["Spring.txt", DataToBeExport, "Expression"]

-Dale



  • Prev by Date: Re: debug compiled function
  • Next by Date: Re: Is Sort stable?
  • Previous by thread: export some data to a specified file?
  • Next by thread: Incrementing a "For" loop - "For loop.nb" 5893 Bytes yEnc