This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Read tabular data from file


[data,varnames,casenames] = tblread
[data,varnames,casenames] = tblread(filename)
[data,varnames,casenames] = tblread(filename,delimiter)


[data,varnames,casenames] = tblread displays the File Open dialog box for interactive selection of a tabular data file. The file format has variable names in the first row, case names in the first column and data starting in the (2, 2) position. Outputs are:

  • data — Numeric matrix with a value for each variable-case pair

  • varnames — Character matrix containing the variable names in the first row of the file

  • casenames — Character matrix containing the names of each case in the first column of the file

[data,varnames,casenames] = tblread(filename) allows command line specification of the name of a file in the current folder, or the complete path name of any file, using the character vector filename.

[data,varnames,casenames] = tblread(filename,delimiter) reads from the file using delimiter as the delimiting character. Accepted values for delimiter are:

  • ' '  or 'space'

  • '\t' or 'tab'

  • ','  or 'comma'

  • ';'  or 'semi'

  • '|'  or 'bar'

The default value of delimiter is 'space'.


[data,varnames,casenames] = tblread('sat.dat')
data =
  470  530
  520  480

varnames =

casenames =

Introduced before R2006a

Was this topic helpful?