dlmread
Read ASCII-delimited file of numeric data into matrix
Syntax
M = dlmread(filename)
M = dlmread(filename,delimiter)
M = dlmread(filename,delimiter,R1,C1)
M = dlmread(filename,delimiter,[R1 C1 R2 C2])
Description
M = dlmread(
reads an ASCII-delimited numeric data file into matrixfilename
)M
. Thedlmread
function detects the delimiter from the file and treats repeated white spaces as a single delimiter.
M = dlmread(
starts reading at row offsetfilename
,delimiter
,R1
,C1
)R1
and column offsetC1
. For example, the offsetsR1=0
,C1=0
specify the first value in the file.
To specify row and column offsets without specifying a delimiter, use an empty character as a placeholder, for example,M = dlmread(filename,'',2,1)
.
Examples
Input Arguments
Tips
Skip header rows or columns by specifying row and column offsets. All values in the file other than headers must be numeric.
Algorithms
dlmread
fills empty delimited fields with zero. When thedlmread
function reads data files with lines that end with a nonspace delimiter, such as a semicolon, it returns a matrix,M
, that has an additional last column of zeros.
dlmread
imports any complex number as a whole into a complex numeric field. This table shows valid forms for a complex number.
Form |
Example |
---|---|
|
|
|
|
Embedded white space in a complex number is invalid anddlmread
regards it as a field delimiter.