Programming | ![]() ![]() |
Importing Delimited ASCII Data Files
If your data file uses a character other than a space as a delimiter, you have a choice of several import functions you can use. (See Table 6-2 for a complete list.) The simplest to use is the dlmread
function.
For example, consider a file named ph.dat
whose contents are separated by semicolons:
To read the entire contents of this file into an array named A
, enter
You specify the delimiter used in the data file as the second argument to dlmread
. Note that, even though the last items in each row are not followed by a delimiter, dlmread
can still process the file correctly. dlmread
ignores space characters between data elements. So, the preceding dlmread
command works even if the contents of ph.dat
are
![]() | Importing Numeric Text Data | Importing Numeric Data with Text Headers | ![]() |
© 1994-2005 The MathWorks, Inc.