Mapping Toolbox | ![]() ![]() |
Convert the elements of hms format to distinct matrix elements
Syntax
Description
[h,m,s] = hms2mat(timein) takes times in hms format and splits their components into three outputs, one each for hours, minutes, and seconds.
[h,m,s] = hms2mat(timein,n) specifies the power of 10, n
, to which the resulting seconds output should be rounded (i.e., if a result is 12.567 seconds, and n
= -2, the resulting seconds output would be 12.57). The default value
of n
is -5.
matout = hms2mat(timein,n) returns a three-column matrix, matout
, in which the columns represent hours, minutes, and seconds, respectively. In this case, timein
must be a vector.
Examples
[h,m,s] = hms2mat(1234.567) h = 12 m = 34 s = 56.7000 matout = hms2mat(1234.567) matout = 12.0000 34.0000 56.7000
See Also
mat2hms |
Convert from separated matrices to hms format |
![]() | hms2hr, hms2sec | hr2hms, hr2hm | ![]() |