This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Arrays in tabular form whose named columns can have different types

table is a data type suitable for column-oriented or tabular data that is often stored as columns in a text file or in a spreadsheet. Tables consist of rows and column-oriented variables. Each variable in a table can have a different data type and a different size with the one restriction that each variable must have the same number of rows. For more information, see Create and Work with Tables or watch Tables and Categorical Arrays.


expand all

tableTable array with named variables that can contain different types
array2tableConvert homogeneous array to table
cell2tableConvert cell array to table
struct2tableConvert structure array to table
table2arrayConvert table to homogeneous array
table2cellConvert table to cell array
table2structConvert table to structure array
table2timetableConvert table to timetable
timetable2tableConvert timetable to table

Basic Import and Export

readtableCreate table from file
writetableWrite table to file

Define Import Rules

detectImportOptionsCreate import options based on file content
getvaroptsGet variable import options
setvaroptsSet variable import options
setvartypeSet variable data types
headGet top rows of table, timetable, or tall array
tailGet bottom rows of table, timetable, or tall array
summaryPrint summary of table, timetable, or categorical array
heightNumber of table rows
widthNumber of table variables
istableDetermine whether input is table


sortrowsSort rows of matrix or table
uniqueUnique values in array
issortedrowsDetermine if matrix or table rows are sorted
topkrowsTop rows in sorted order

Rearrange Variables

addvarsAdd variables to table or timetable
movevarsMove variables in table or timetable
removevarsDelete variables from table or timetable
splitvarsSplit multicolumn variables in table or timetable
mergevarsCombine table or timetable variables into multicolumn variable
vartypeSubscript into table or timetable by variable type


rows2varsReorient table or timetable so that rows become variables
stackStack data from multiple variables into single variable
unstackUnstack data from single variable into multiple variables
inner2outerInvert nested table-in-table hierarchy in tables or timetables

Join Using Key Variables

joinCombine two tables or timetables by rows using key variables
innerjoinInner join between two tables or timetables
outerjoinOuter join between two tables or timetables

Set Operations

unionSet union of two arrays
intersectSet intersection of two arrays
ismemberArray elements that are members of set array
setdiffSet difference of two arrays
setxorSet exclusive OR of two arrays
ismissingFind missing values
standardizeMissingInsert standard missing values
rmmissingRemove missing entries
fillmissingFill missing values
varfunApply function to table or timetable variables
rowfunApply function to table or timetable rows
findgroupsFind groups and return group numbers
splitapplySplit data into groups and apply function
groupsummaryGroup summary computations


Advantages of Using Tables

Use tables to store mixed-type data conveniently, access data with numeric or named indexing, and to store metadata.

Create and Work with Tables

This example shows how to create a table from workspace variables, work with table data, and write tables to files for later use.

Access Data in a Table

Indexing into tables with parentheses, curly braces, and dot notation has different results. You can use indexing to create a table that is a subset of a larger table or to create an array from data in a table.

Calculations on Tables

This example shows how to perform calculation on tables.

Changes to DimensionNames Property in R2016b

Tables can raise compatibility warnings, and change dimension names, when you modify the DimensionNames property.

Was this topic helpful?