Areadr: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Neal
Line 1: Line 1:
===Purpose===
===Purpose===


Line 12: Line 11:
Inputs are (file) an ASCII string containing the file name to be read, (nline) the number of rows to skip before reading or a character string containing the last few characters before the first number to be read (used to skip the header information), (nvar) the number of rows or columns in the matrix to be read, and (flag) which indicates whether (nvar) is the number of rows (flag=1) or the number of columns (flag=2) in the matrix.
Inputs are (file) an ASCII string containing the file name to be read, (nline) the number of rows to skip before reading or a character string containing the last few characters before the first number to be read (used to skip the header information), (nvar) the number of rows or columns in the matrix to be read, and (flag) which indicates whether (nvar) is the number of rows (flag=1) or the number of columns (flag=2) in the matrix.


AREADR can be incorporated into other routines to read data directly from groups of files. For example, to read the file mydata.txt with a 5 line header and 8 columns in the data into the matrix mymatrix:
AREADR can be incorporated into other routines to read data directly from groups of files. For example, to read the file "mydata.txt" with a 5 line header and 8 columns in the data into the matrix mymatrix:


mymatrix = areadr('mydata.txt',5,8,2)
mymatrix = areadr('mydata.txt',5,8,2)
Line 38: Line 37:
mymatrix = areadr('mydata.txt','END OF HEADER INFORMATION',4,1)
mymatrix = areadr('mydata.txt','END OF HEADER INFORMATION',4,1)


For an automatic text file parser which can handle this type of file without knowing the format, see xclreadr.
For an automatic text file parser which can handle this type of file without knowing the format, see XCLREADR.


===See Also===
===See Also===


[[dlmread]], [[import]], [[spcreadr]], [[xclgetdata]], [[xclputdata]], [[xclreadr]], [[xlsreadr]]
[[dlmread]], [[import]], [[spcreadr]], [[xclgetdata]], [[xclputdata]], [[xclreadr]], [[xlsreadr]]

Revision as of 11:48, 25 September 2008

Purpose

Reads ASCII text file into workspace and strips off header.

Synopsis

out = areadr1(file,nline,nvar,flag)

Description

Inputs are (file) an ASCII string containing the file name to be read, (nline) the number of rows to skip before reading or a character string containing the last few characters before the first number to be read (used to skip the header information), (nvar) the number of rows or columns in the matrix to be read, and (flag) which indicates whether (nvar) is the number of rows (flag=1) or the number of columns (flag=2) in the matrix.

AREADR can be incorporated into other routines to read data directly from groups of files. For example, to read the file "mydata.txt" with a 5 line header and 8 columns in the data into the matrix mymatrix:

mymatrix = areadr('mydata.txt',5,8,2)

Given header information in a text file with the following contents:

HEADER INFORMATION

HEADER ONE

HEADER TWO

END OF HEADER INFORMATION

1 2 1 2

2 3 2 3

3 4 3 4

4 5 4 5

The following command will read the 4 rows of data following the character string "END OF HEADER INFORMATION":

mymatrix = areadr('mydata.txt','END OF HEADER INFORMATION',4,1)

For an automatic text file parser which can handle this type of file without knowing the format, see XCLREADR.

See Also

dlmread, import, spcreadr, xclgetdata, xclputdata, xclreadr, xlsreadr