I'm new to SO and Matlab so please excuse any transgressions. I'm trying to convert a seemingly simple array of timestamp strings to an equivalent array of seconds.
I wrote a this function:
% Function to calculate seconds from a timestamp in the following format:
% ddd hh:mm:ss.SSSS (example: 123 12:59:00.9999)
function a = TimestampToS(stamp)
% Uses the "named tokens" facility of MATLAB's "regexp" function.
expr = ['(?\d+)' ... % ddd
' ' ... % Space " " separator
'(?\d+)' ... % hh
':' ... % Colon ":" separator
'(?\d+)' ... % mm
':' ... % Colon ":" separator
'(?\d+)' ... % ss
'.' ... % Dot "." separator
'(?\d+)']; % SSSS
parsedStamp = regexp(stamp, expr,