(Not recommended) Read Microsoft Excel spreadsheet file
xlsread
is not recommended. Use readtable
, readmatrix
, or readcell
instead. For more information, see Compatibility
Considerations.
reads data from the spreadsheet in num
= xlsread(filename
,sheet
,xlRange
,'basic'
)basic
import mode. If your
computer does not have Excel for Windows® or if you are using MATLAB®
Online™, xlsread
automatically operates in
basic
import mode, which supports XLS, XLSX, XLSM, XLTX,
and XLTM files.
If you do not specify all the arguments, use empty character vectors,
''
, as placeholders, for example, num =
xlsread(filename,'','','basic')
.
___ = xlsread(
opens an Excel window to interactively select data. Select the worksheet, drag
and drop the mouse over the range you want, and click OK.
This syntax is supported only on Windows computers with Microsoft
Excel software installed.filename
,-1)
[
,
where num
,txt
,raw
,custom
]
= xlsread(filename
,sheet
,xlRange
,'',processFcn
)processFcn
is a function handle, reads from the
spreadsheet, calls processFcn
on the data, and returns the
final results as numeric data in array num
. The
xlsread
function returns the text fields in cell array
txt
, both the numeric and text data in cell array
raw
, and the second output from
processFcn
in array custom
. The
xlsread
function does not change the data stored in the
spreadsheet. This syntax is supported only on Windows computers with Excel software.
xlsread
reads only 7-bit ASCII characters.
xlsread
does not support non-contiguous ranges.
If your computer does not have Excel for Windows or if you are using MATLAB
Online, xlsread
automatically operates in
basic
import mode.
On Linux® and Mac platforms, xlsread
cannot open spreadsheet
files written by the writetable
function.
xlsread
imports formatted text representing dates (such as
'10/31/96'
), except when importing in
basic
mode.