1

MATLAB でタブ区切りのテキスト ファイルから科学表記法を読み取ることができる組み込み関数はありますか?

データの行は次のようになります。

-1.52E-01   -1.32E-01   7.20E-02    -6.78E-04   1.97E-04    -1.89E-03   0.00E+00

私はtdfread(filename, delimiter)成功せずに試しました。

4

2 に答える 2

3

探しているコマンドはdlmread.

同様に動作する GNU Octave のヘルプ エントリを次に示します。

DATA = dlmread (FILE)
DATA = dlmread (FILE, SEP)
DATA = dlmread (FILE, SEP, R0, C0)
DATA = dlmread (FILE, SEP, RANGE)
DATA = dlmread (..., "emptyvalue", EMPTYVAL)

  Read numeric data from the text file FILE which uses the delimiter
  SEP between data values.

  If SEP is not defined the separator between fields is determined
  from the file itself.

  The optional scalar arguments R0 and C0 define the starting row and
  column of the data to be read.  These values are indexed from zero,
  i.e., the first data row corresponds to an index of zero.

  The RANGE parameter specifies exactly which data elements are read.
  The first form of the parameter is a 4-element vector containing
  the upper left and lower right corners '[R0,C0,R1,C1]' where the
  indices are zero-based.  Alternatively, a spreadsheet style form
  such as "A2..Q15" or "T1:AA5" can be used.  The lowest alphabetical
  index 'A' refers to the first column.  The lowest row index is 1.

  FILE should be a filename or a file id given by 'fopen'.  In the
  latter case, the file is read until end of file is reached.

  The "emptyvalue" option may be used to specify the value used to
  fill empty fields.  The default is zero.  Note that any non-numeric
  values, such as text, are also replaced by the "emptyvalue".

  See also: csvread, textscan, textread, dlmwrite.
于 2012-07-07T00:17:44.530 に答える