To specify a subset of rows for a single variable, you can follow the dot indexing with
parentheses or curly braces. Extract the heights of the nonsmoker patients under the age
of 30.
Use dot notation to extract data from table variables and a logical expression to define
the subset of rows based on that extracted data.
rows = patients.Smoker==false & patients.Age<30;
Use dot notation to extract the desired rows from the variable, Height.
patients.Height(rows)
ans = 11×1
68
71
70
63
64
63
65
66
68
66
⋮
The output is a 11-by-1 numeric array. Alternatively, you can specify the single variable,
Height, within curly braces to extract the desired data, patients{rows,'Height'}.
See Also
histogram | summary | table
Related Examples
- “Create and Work with Tables” on page 9-2
- “Modify Units, Descriptions, and Table Variable Names” on page 9-34
- “Calculations on Tables” on page 9-53
See Also