DADiSP Worksheet Functions > Function Categories > Data Input/Output Functions > WRITEA

 

WRITEA

Purpose:

Writes one or more series to an ASCII (text) or CSV file.

Syntax:

WRITEA(

"filename", ser1, ser2, ..., serN, overwrite, prec, header, verbose, "delstr", "format")

"filename"

-

A string. The name of the ASCII file to write. If no path is given, WRITETA writes the file in the current working directory.

serN

-

Optional. A zero or more series, the data to write. Defaults to the series in the current Window.

overwrite

-

Optional. An integer. The file overwrite mode.

0:

prompt before overwriting file (default).

1:

overwrite file if it exists without prompting.

2:

append data to the specified file. 

prec

-

Optional. An integer, the digit precision. Defaults to –1, automatic.

header  

-

Optional. An integer, prepend header text flag.

0:

do not prepend header (default).

1:

prepend series comment.

2:

prepend series units.

3:

prepend series comment and units. 

verbose

-

Optional. An integer, the display progress messages flag. Defaults to 1, display.

"delstr"  

-

Optional. A string, the column delimiters (separators). Defaults to space (" ").

"format"

-

Optional. A string, the number format. Defaults to "%f", floating point values.

Example:

writea("SINETEST",gsin(20,0.1))

 

puts the generated sine wave into an ASCII (text) file named SINETEST without a header.

Example:

writea("C:\temp\3ser.csv", gsin(100, 1/100, 1), gcos(100, 1/100, 1), 1..100, ",", "%g")

 

writes three series to the ASCII (text) file named 3ser,csv without a header. Each column is separated by a "," and the numeric format is compact float.

Remarks:

WRITEA is one way to export one or more series to a text file. Although a comment and unit line can be included, it does not export a full header with complete series information as per the Export Utilites.

 

See SPRINTF for details on the optional format string. When specifying a format string, a delimiter string must precede the format string.

 

See WRITETABLE to write a multi-column series to a file as ASCII or CSV. WRITETABLE can write one or more columns of data and provides more extensive file writing options.

See Also:

EXPORTFILE

FWRITEA

IMPORTFILE

READA

READB

READTABLE

SPRINTF

WRITEB

WRITETABLE