Combine values from multiple table variables into one table variable in the Live Editor
The Stack Table Variables task lets you interactively stack values from multiple table or timetable variables into one variable. The task automatically generates MATLAB® code for your live script.
To add the Stack Table Variables task to a live script in the MATLAB Editor:
On the Live Editor tab, select Task > Stack Table Variables.
In a code block in the script, type a relevant keyword, such as
stack
or table
. Select Stack Table
Variables from the suggested command completions.
Input table
— Names of table or timetableSpecify the name of the input table or timetable timetables from the lists of all the nonempty tables and timetables that are in the workspace.
Variables to stack
— Actions for input variablesSpecify the action to take for each variable in the input table or timetable. When stacking variables, there are three possible actions:
Constant — Copy the variable to the output table or timetable. Replicate its values where needed in rows of the output.
Stack — Stack the values from the variable into one variable of the output. For example, if you choose to stack three variables, all their values go into one variable of the output.
Discard — Exclude the variable and its values from the output.
join
| Join Tables | stack
| unstack
| Unstack Table Variables