cst2hms_or_datenum.m
Convert a time in CST to hours min sec local time
Syntax
hms_or_datenum = cst2hms_or_datenum(tag,cst, d3, TAGON, GMT2LOC, output) % Matlab/Octave
Description
Convert a time in CST (sec since start of recording) to hours min sec local time or convert a time in CST to a matlab serial date number indicating local time.
Inputs
Input var | Description | Units | Default value |
---|---|---|---|
tag | is tag id string eg zc11_267a | N/A | N/A |
cst | is a scalar or a vector of times to convert, in seconds since start of recording. | N/A | N/A |
d3 | is 0 if the tag was a dtag2, or 1 if a d3 (if 1, then it will be assumed that the TAGON in the cal file is in UTC and GMT2LOC will be used to covert to local). | N/A | N/A |
tagon | is optional argument which should be a vector with tagon time as [yyyy mm dd hh mm ss], in case there is no cal file for this tag available. | N/A | N/A |
GMT2LOC | is optional conversion factor for GMT to local time, if d3=1 and tagon is given then GMT2LOC should be given as well. | N/A | N/A |
output | specifies whether you would like to be given a datenumber or a date/time string. If output == 'datenum', this function will convert a time in CST to a matlab serial date number indicating local time (may be useful to plot with date number as y axis of plot, using datetick to label the axis in human-legible local time…). If output = 'datestr', this function will convert a time in CST (sec since start of recording) to hours min sec local time. | N/A | N/A |
Outputs
Output var | Description | Units |
---|---|---|
N/A | The output is either a datenumber (a vector of serial date numbers) or a date/time string (a matrix of strings where row n is a string indicating the local time for entry n of csts) depending on the input for “output”. | N/A |
Notes & assumptions
- Right now, this function requires a tag path to be set so that the command “loadcal(tag)” will work; for future d3 cases where that is silly, edit the first lines of the code.
Example
cst2hms_or_datenum('zc11_267a', [1:2], 1, [1111,11,11,11,11,11],2, 'datestr') Returns: '13:11:12.000' '13:11:13.000' cst2hms_or_datenum('zc11_267a', [1:2], 1, [1111,11,11,11,11,11],2, 'datenum') Returns: 1.0e+05 * 4.0610 4.0610
About
bugs@animaltags.org Last modified: 24 July 2017