Data Import and Export

Move data into and out of MATLAB®

Use the data import functions available in Statistics and Machine Learning Toolbox™ to import data into the MATLAB workspace from different file formats. Valid formats include tabular data, tab-delineated files, Microsoft® Excel® spreadsheets, and SAS® XPORT files. Alternatively, use the Import Tool to select and import data interactively.

Export data from the workspace, including case names, dataset arrays, and tabular data, and save it in a MATLAB-supported file format.


casereadRead case names from file
casewriteWrite case names to file
export(Not Recommended) Write dataset array to file
tblreadRead tabular data from file
tblwriteWrite tabular data to file
tdfreadRead tab-delimited file
xlsread(Not recommended) Read Microsoft Excel spreadsheet file
xptreadCreate table from data stored in SAS XPORT format file


Sample Data Sets

Data sets contain individual data variables, description variables with references, and dataset arrays encapsulating the data set and its description, as appropriate.