I have time series per minute that look as shown below. The format is like '"hh:mm"' as seen below
'"8:59"' '"9:00"' '"9:01"' '"9:02"' '"9:03"' '"9:04"' '"9:05"' '"9:06"' '"9:07"'
Is it possible to change these to hhmm format in matlab like 859 900 901 902 t0 a double format.
You can use a function like
strrep
orregexprep
to get rid of the colon in the string. For example:Or the slightly bizarre
regexprep
call:Returns
Which you can then use with
str2double
to generate your vector of doubles:Which returns:
I'd also recommend taking a look at
datenum
anddatestr
, which are the MATLAB builtins for manipulating serial date values. For example:Returns:
And to go back:
Which returns: