DLMREAD Read ASCII-delimited File

Section: Input/Ouput Functions

Usage

Loads a matrix from an ASCII-formatted text file with a delimiter between the entries. This function is similar to the load -ascii command, except that it can handle complex data, and it allows you to specify the delimiter. Also, you can read only a subset of the data from the file. The general syntax for the dlmread function is
    y = dlmread(filename)

where filename is a string containing the name of the file to read. In this form, FreeMat will guess at the type of the delimiter in the file. The guess is made by examining the input for common delimiter characters, which are ,;: or a whitespace (e.g., tab). The text in the file is preprocessed to replace these characters with whitespace and the file is then read in using a whitespace for the delimiter. If you know the delimiter in the file, you can specify it using this form of the function:

    y = dlmread(filename, delimiter)

where delimiter is a string containing the delimiter. If delimiter is the empty string, then the delimiter is guessed from the file. You can also read only a portion of the file by specifying a start row and start column:

    y = dlmread(filename, delimiter, startrow, startcol)

where startrow and startcol are zero-based. You can also specify the data to read using a range argument:

    y = dlmread(filename, delimiter, range)

where range is either a vector [startrow,startcol,stoprow,stopcol] or is specified in spreadsheet notation as B4..ZA5. Note that complex numbers can be present in the file if they are encoded without whitespaces inside the number, and use either i or j as the indicator. Note also that when the delimiter is given, each incidence of the delimiter counts as a separator. Multiple separators generate zeros in the matrix.