TT.Properties.DimensionNames{1} = 'Date';
TT.Properties.DimensionNames
ans = 1x2 cell array
{'Date'} {'Variables'}
As an alternative, you can specify the row times as the first input argument to
timetable, without specifying 'RowTimes'. The timetable function names the row
times, or the first dimension, after the first input argument, just as it names the timetable
variables after the other input arguments.
TT = timetable(Date,X,Y,Z)
TT=8×4 timetable
Date X Y Z
10-Jul-2016 1 'a' 1
10-Jul-2016 1 'b' 2
11-Jul-2016 1 'a' 3
11-Jul-2016 1 'b' 4
10-Jul-2016 2 'a' 5
10-Jul-2016 2 'b' 6
11-Jul-2016 2 'a' 7
11-Jul-2016 2 'b' 8
Sort the timetable by row times. To sort on row times, refer to the first dimension of the
timetable by name.
sortrows(TT,'Date')
ans=8×4 timetable
Date X Y Z
10-Jul-2016 1 'a' 1
10-Jul-2016 1 'b' 2
10-Jul-2016 2 'a' 5
10-Jul-2016 2 'b' 6
11-Jul-2016 1 'a' 3
11-Jul-2016 1 'b' 4
11-Jul-2016 2 'a' 7
Using Row Labels in Table and Timetable Operations