TOC PREV NEXT INDEX

DVtable_read

Synopsis

Reads a column-oriented text file

module DVtable_read {
DVtable_column+Iparam &columns[];
int+read+write+notify+opt do;
string+Iparam filename;
string+Iparam delimiter;
int+Iparam header; // has a header to be read
int+Iparam skip_lines;
// lines at the start of the file to skip
int+Iparam index_column;
// generate a synthetic index column
Data_Array+Oparam out[] {
veclen = 1;
};
int+Oparam tbl_nrow; // number of table rows read
int+Oparam tbl_ncol;// number of table columns read
omethod+notify_inst+notify_val upd_func<status=1>
= "DVtable_read_update";
};

Description

DVtable_read reads a text data file that contains columns of data separated by a special character (e.g. tab). These types of files often result from exporting a spreadsheet or database into a text format. Each column of data is handled independently Information about how to handle each column in the data file is specified by the the columns input which is an array of type DVtable_column. For each column, the data type and whether or not to read the column must be specified.The output is not a field. As the data file may have columns with different data types (e.g. one column of floats and a second column of text strings), the reader does not attempt to construct an output field. Instead the output is an array of type Data_Array, one Data_Array per column of data read. Modules such as DVtable_data_create, DVtable_to_unif, and DVtable_to_scat can then be used to turn the Data_Arrays into a field. If the data file is a uniform (all columns have same data type) grid of numerical data, then DVgrid_read is a easier to use alternative.

Input

filename

A string. Names the input file to be read. The string can be either the complete absolute pathname, or a relative pathname. If it is relative, it will be interpreted relative to the user's working directory when AVS/Express was started.

delimiter

A string indicating the column separator such as a space, tab, comma, etc.

header

Boolean that specifies whether there is a header to be read in.

skip_lines

integer. The number of lines to skip at the start of the file

index_column

integer. Specifies whether to generate a synthetic index column

data type

integer. The type of data to be read in

tbl_nrow

integer. Specifies the number of rows read

tbl_ncol

integer. Specifies the number of columns read

Output

out

The output is an array of Data_Array.

Example

Not available.

File

v/dv.v

See also

DVgrid_read
DVread_seq_binary
DVread_seq_ascii

TOC PREV NEXT INDEX