MATLAB Function Reference Previous page   Next Page
dlmread

Read ASCII-delimited file of numeric data into matrix

Graphical Interface

As an alternative to dlmread, use the Import Wizard. To activate the Import Wizard, select Import data from the File menu.

Syntax

Description

M = dlmread('filename') reads from the ASCII-delimited numeric data file filename to output matrix M. The delimiter separating data elements is inferred from the formatting of the file. Comma (,) is the default delimiter.

M = dlmread('filename', delimiter) reads numeric data from the ASCII-delimited file filename, using the specified delimiter. Use \t to specify a tab delimiter.

M = dlmread('filename', delimiter, R, C) reads numeric data from the ASCII-delimited file filename, using the specified delimiter. The values R and C specify the row and column where the upper left corner of the data lies in the file. R and C are zero based, so that R=0, C=0 specifies the first value in the file, which is the upper left corner.

M = dlmread('filename', delimiter, range) reads the range specified by range = [R1 C1 R2 C2] where (R1,C1) is the upper left corner of the data to be read and (R2,C2) is the lower right corner. You can also specify the range using spreadsheet notation, as in range = 'A1..B7'.

Remarks

dlmread fills empty delimited fields with zero. Data files having lines that end with a nonspace delimiter, such as a semicolon, produce a result that has an additional last column of zeros.

dlmread imports any complex number as a whole into a complex numeric field, converting the real and imaginary parts to the specified numeric type. Valid forms for a complex number are

Form
Example
±<real>±<imag>i|j
5.7-3.1i
±<imag>i|j
-7j

Embedded white-space in a complex number is invalid and is regarded as a field delimiter.

See Also

dlmwrite, textscan, csvread, csvwrite, wk1read, wk1write


Previous page  divergence dlmwrite Next page

© 1994-2005 The MathWorks, Inc.