Weight: 100x1 double
Values:
Min 111
Median 142.5
Max 202
Smoker: 100x1 logical
Values:
True 34
False 66
Index Using Numeric Indices
Create a subtable containing the first five rows and all the variables from the table,
patients. Use numeric indexing within the parentheses to specify the desired rows and
variables. This is similar to indexing with numeric arrays.
T1 = patients(1:5,:)
T1=5×5 table
Age Gender Height Weight Smoker
Smith 38 'Male' 71 176 true
Johnson 43 'Male' 69 163 false
Williams 38 'Female' 64 131 false
Jones 40 'Female' 67 133 false
Brown 49 'Female' 64 119 false
T1 is a 5-by-5 table. In addition to numeric indices, you can use row or variable names
inside the parentheses. In this case, using row indices and a colon is more compact than
using row or variable names.
Index Using Names
Select all the data for the patients with the last names 'Adams' and 'Brown'. In this
case, it is simpler to use the row names than to use the numeric index.
T2 = patients({'Adams','Brown'},:)
Access Data in a Table