Tables
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.
Functions
expand all
Create Tables and Convert Type
Read and Write Files
Basic Import and Export
Define Import Rules
Summary Information and Stacked Plot
head | Get top rows of table, timetable, or tall array |
tail | Get bottom rows of table, timetable, or tall array |
summary | Print summary of table, timetable, or categorical array |
height | Number of table rows |
width | Number of table variables |
istable | Determine whether input is table |
stackedplot | Stacked plot of several variables with common x-axis |
Sort, Rearrange, and Customize
Sort
Rearrange Variables
addvars | Add variables to table or timetable |
renamevars | Rename variables in table or timetable |
movevars | Move variables in table or timetable |
removevars | Delete variables from table or timetable |
splitvars | Split multicolumn variables in table or timetable |
mergevars | Combine table or timetable variables into multicolumn variable |
vartype | Subscript into table or timetable by variable type |
convertvars | Convert table or timetable variables to specified data type |
Reshape
rows2vars | Reorient table or timetable so that rows become variables |
stack | Stack data from multiple variables into single variable |
unstack | Unstack data from single variable into multiple variables |
inner2outer | Invert nested table-in-table hierarchy in tables or timetables |
Customize Properties
addprop | Add custom properties to table or timetable |
rmprop | Remove custom properties from table or timetable |
Join and Set Operations
Join Using Key Variables
join | Combine two tables or timetables by rows using key variables |
innerjoin | Inner join between two tables or timetables |
outerjoin | Outer join between two tables or timetables |
Set Operations
union | Set union of two arrays |
intersect | Set intersection of two arrays |
ismember | Array elements that are members of set array |
setdiff | Set difference of two arrays |
setxor | Set exclusive OR of two arrays |
Apply Functions to Table Contents
varfun | Apply function to table or timetable variables |
rowfun | Apply function to table or timetable rows |
findgroups | Find groups and return group numbers |
splitapply | Split data into groups and apply function |
groupsummary | Group summary computations |
vartype | Subscript into table or timetable by variable type |
convertvars | Convert table or timetable variables to specified data type |
Live Editor Tasks
Join Tables | Combine two tables using key variables in the Live Editor |
Stack Table
Variables | Combine values from multiple table variables into one table variable in the Live
Editor |
Unstack Table
Variables | Distribute values from one table variable to multiple table variables in the Live
Editor |
Topics
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 Tables
Indexing into tables with parentheses, dot notation, and curly braces accesses table
data in different ways. 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.