'Smith' 38 'Male' true 71 176 24.547 124 93
'Johnson' 43 'Male' false 69 163 24.071 109 77
'Williams' 38 'Female' false 64 131 22.486 125 83
'Jones' 40 'Female' false 67 133 20.831 117 75
'Brown' 49 'Female' false 64 119 20.426 122 80
Delete Variable Using Dot Syntax
As an alternative, you can delete variables using dot syntax and the empty matrix, [].
Remove the Age variable from the table.
T.Age = [];
head(T,5)
ans=5×7 table
LastName Gender Smoker Height Weight BMI BloodPressure
'Smith' 'Male' true 71 176 24.547 124 93
'Johnson' 'Male' false 69 163 24.071 109 77
'Williams' 'Female' false 64 131 22.486 125 83
'Jones' 'Female' false 67 133 20.831 117 75
'Brown' 'Female' false 64 119 20.426 122 80
Delete Variable Using Indexing
You also can delete variables using indexing and the empty matrix, []. Remove the
Gender variable from the table.
T(:,'Gender') = [];
head(T,5)
ans=5×6 table
LastName Smoker Height Weight BMI BloodPressure
'Smith' true 71 176 24.547 124 93
'Johnson' false 69 163 24.071 109 77
'Williams' false 64 131 22.486 125 83
'Jones' false 67 133 20.831 117 75
'Brown' false 64 119 20.426 122 80
Add, Delete, and Rearrange Table Variables