Re: Formatting WRITE_CSV output [message #70888] |
Thu, 13 May 2010 12:45 |
fgg
Messages: 67 Registered: April 2010
|
Member |
|
|
> Not directly. If your data are strings, you can format them first,
> then give them to write_csv, such as
>
> write_csv,file,string(data1,format=...),string(data2,format= ...)
>
> But write_csv encapsulates strings in quotes, which is probably
> undesirable if your data were not strings.
>
> So it is probably better to use plain old printf with the format you
> want plus the commas to separate the fields.
Thanks, pp. I guess I'll go with printf. Another disadvantage of
write_csv is that it limits the number of output columns to 8.
|
|
|
Re: Formatting WRITE_CSV output [message #70896 is a reply to message #70888] |
Wed, 12 May 2010 18:32  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On May 12, 10:00 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
> Hi,
>
> Is it possible to use format codes with WRITE_CSV? In other words, can
> I specify the output format for each "Data" below?
>
> WRITE_CSV, Filename, Data1 [, Data2,..., Data8] [, HEADER=variable]
>
> Thank you!
Not directly. If your data are strings, you can format them first,
then give them to write_csv, such as
write_csv,file,string(data1,format=...),string(data2,format= ...)
But write_csv encapsulates strings in quotes, which is probably
undesirable if your data were not strings.
So it is probably better to use plain old printf with the format you
want plus the commas to separate the fields.
|
|
|