Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Reading and Writing
See also: write read readm

Function: readascii
Description: readascii is a command to read ASCII data from a file.

Usage: {data, type} = readascii (filename, separator {, check})
Input:
filename string with the name of the file to be read
separator string with field separators
check determine type (default 1)
Output:
data n x 1 string(!) vector
type n x 1 numeric vector

Note:

Example:
w = readascii("geyser", " \t\n")
w

Result:
Contents of w.data

[  1,] "0.360000E+01"
[  2,] "79."
[  3,] "
"
[  4,] "0.180000E+01"
[  5,] "54."
[  6,] "
"
...
[814,] "0.446667E+01"
[815,] "74."
[816,] "
"
Contents of w.type

[  1,]        0
[  2,]        0
[  3,]       20
[  4,]        0
[  5,]        0
[  6,]       20
...
[814,]        0
[815,]        0
[816,]       20
Example:
w = readascii("geyser", " \t\n", 0)
w

Result:
Contents of w.data

[  1,] "0.360000E+01"
[  2,] "79."
[  3,] "
"
[  4,] "0.180000E+01"
[  5,] "54."
[  6,] "
"
...
[814,] "0.446667E+01"
[815,] "74."
[816,] "
"
 Contents of w.type

[  1,] 10
[  2,] 10
[  3,] 20
[  4,] 10
[  5,] 10
[  6,] 20
...
[814,] 10
[815,] 10
[816,] 20



(C) MD*TECH Method and Data Technologies, 05.02.2006