Pivot Table
Description
The Pivot Table task lets you interactively summarize tabular data in a pivoted table according to column and row groups. The task automatically generates MATLAB® code for your live script. For more information about Live Editor tasks generally, see Add Interactive Tasks to a Live Script.
A pivoted table provides a summary of tabular data. Pivoted tables are useful for analyzing and providing insights into large data sets and organizing data from another perspective, according to column and row groups. The column and row labels of a pivoted table are group names, and the data values are group counts or the result of another computation method. For more information, see Pivoting Operation.
Using this task, you can:
Create a pivoted table and specify grouping variables to designate pivoted table rows and columns.
Focus on a subset of rows by filtering the input table.
View sparklines and summary statistics to quickly visualize and interpret the data in each table or timetable variable.
Fill the values of the pivoted table by specifying the computation method and table variable.
Customize the format and contents of the pivoted table.
Visualize the pivoted table in a chart.
Open the Task
To add the Pivot Table task to a live script in the MATLAB Editor:
On the Live Editor tab, select Task > Pivot Table.
In a code block in the script, type a relevant keyword, such as
pivot
,group
, orcrosstab
. Select Pivot Table from the suggested command completions.
Parameters
Tips
The Pivot Table task can apply the computation method to at most one data variable. To apply multiple computation methods or specify multiple data variables, use the Compute by Group task.
Version History
Introduced in R2023b