textread [file] [io]
— Loadable Function: [a, b, c, ...] = textread (filename, format[, N])
— Loadable Function: [a, b, c, ...] = textread (..., prop, value)

Read data from the columns of a text file.

Columns containing strings are returned as cell-arrays, while numeric values are returned as matrices.

The string format describes the different columns of the text file and is repeated N times. It may continue the following specifiers:

%s
for a string,
%d,%f
for a double, floating-point or integer number and
%*
to ignore a column.

For example, the textfile containing

          Bunny Bugs   5.5
          Duck Daffy  -7.5e-5
          Penguin Tux   6

can be read using

          [a,b,c] = textread("test.txt\", \"%s %s %f\").

Currently implemented prop arguments are:

  • \"headerlines\": value represents the number of header lines to skip.

See also: load, dlmread, fscanf