m = 1×3
4 5 6
d = 1×3
13 14 15
Use the hms function to get the hour, minute, and second values of t as three separate
numeric arrays.
[h,m,s] = hms(t)
h = 1×3
23 19 15
m = 1×3
12 12 12
s = 1×3
56.8970 56.8970 56.8970
Modify Date and Time Components
Assign new values to components in an existing datetime array by modifying the
properties of the array. Use dot notation to access a specific property.
Change the year number of all datetime values in t to 2014. Use dot notation to modify
the Year property.
t.Year = 2014
t = 1x3 datetime array
13-Apr-2014 23:12:56 14-May-2014 19:12:56 15-Jun-2014 15:12:56
Change the months of the three datetime values in t to January, February, and March,
respectively. You must specify the new value as a numeric array.
7 Dates and Time