Convert a time in CST to hours min sec local time

hms_or_datenum = cst2hms_or_datenum(tag,cst, d3, TAGON, GMT2LOC, output)    % Matlab/Octave

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.

Input var Description Units Default value
tag is tag id string eg zc11_267aN/AN/A
cst is a scalar or a vector of times to convert, in seconds since start of recording.N/AN/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/AN/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/AN/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/AN/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/AN/A
Output var Description Units
N/AThe 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
• 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.
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