Main Content

Tables

Arrays in tabular form whose named columns can have different types

tableis 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, seeCreate Tables and Assign Data to Themor watchTables and Categorical Arrays.

Functions

expand all

table Table array with named variables that can contain different types
array2table Convert homogeneous array to table
cell2table Convert cell array to table
struct2table Convert structure array to table
table2array Convert table to homogeneous array
table2cell Convert table to cell array
table2struct Convert table to structure array
table2timetable Convert table to timetable
timetable2table Convert timetable to table
vartype Subscript into table or timetable by variable type
convertvars Convert table or timetable variables to specified data type

Basic Import and Export

readtable Create table from file
writetable Write table to file

Define Import Rules

detectImportOptions 基于文件内容的创建导入选项
spreadsheetImportOptions Import options object for Spreadsheets
getvaropts Get variable import options
setvaropts Set variable import options
setvartype Set variable data types
preview Preview eight rows from file using import options

Parquet Files

parquetread Read columnar data from a Parquet file
parquetwrite Write columnar data to Parquet file
parquetinfo Get information about Parquet file
summary Print summary of table, timetable, or categorical array
height Number of table rows
width Number of table variables
istable Determine if input is table
istabular Determine if input is table or timetable
head Get top rows of table, timetable, or tall array
tail Get bottom rows of table, timetable, or tall array
堆栈edplot Stacked plot of several variables with common x-axis

Sort

sortrows Sort rows of matrix or table
unique Unique values in array
issortedrows Determine if matrix or table rows are sorted
topkrows Top rows in sorted order

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 data from input table or timetable into one variable in output table or timetable
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 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
anymissing Determine if any array element is missing
ismissing Find missing values
standardizeMissing Insert standard missing values
rmmissing Remove missing entries
fillmissing Fill missing values
groupcounts Number of group elements
groupfilter Filter by group
groupsummary Group summary computations
grouptransform Transform by group
findgroups Find groups and return group numbers
splitapply Split data into groups and apply function
rowfun Apply function to table or timetable rows
varfun Apply function to table or timetable variables
vartype Subscript into table or timetable by variable type
convertvars Convert table or timetable variables to specified data type

Live Editor Tasks

Compute by Group Summarize, transform, or filter by group in the Live Editor
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