The following are also possible:
Rename only some variables (note the parentheses on the left-hand side and the cell array of strings on the right-hand side) ...
>> T.Properties.VariableNames([1 3]) = {'Gender' 'Height'}
T =
Gender Var2 Height Var4
______ ____ ______ ____
M 38 71 176
M 43 69 163
F 38 64 131
F 40 67 133
F 49 64 119
... or rename only one variable (note the braces on the LHS instead of parentheses, and the raw string on the RHS) ...
>> T.Properties.VariableNames{2} = 'Age'
T =
Gender Age Height Var4
______ ___ ______ ____
M 38 71 176
M 43 69 163
F 38 64 131
F 40 67 133
F 49 64 119
... or rename a variable when you only know its (old) name.
>> T.Properties.VariableNames{'Var4'} = 'Weight'
T =
Gender Age Height Weight
______ ___ ______ ______
M 38 71 176
M 43 69 163
F 38 64 131
F 40 67 133
F 49 64 119
0 Comments
Sign in to comment.