MATLAB: Converting date/time stamp in output file to Matlab date/time

convert date and timeimport time data

I have a csv file with data that is time stamped. The date/time is in the following format: 2013/2/12-3h49:26. I was able to import the date/time stamps as strings in a cell array. I now want to convert the date/time from a string to a numeric value so I can use it to graph the data. I looked at using datestr(D,F) and datevec(D,F) but the format of my time stamp does not match any of the Matlab formats 'F'. I tried using sscanf and was able to get it to work for a single string variable but I did not know how (or if it can) be used for an array comprised of strings. I also tried fscanf but was unable to get it to read the data. As an example I used the following to see if I could read the year only:
fid=fopen('WZ-CONT-2013_2_12.csv');
year=fscanf(fid,'%f');
fclose(fid);
If I am reading the csv file, it needs to read a specific column but skip the first two rows amd read until there are no more entires (number of readings may vary).
Example date/time stamps:
2013/2/12-3h49:26
2013/2/12-3h59:26
2013/2/12-4h9:26
2013/2/12-4h19:26
Thanks in advance for your help!

Best Answer

Hint 1:
cac = { '2013/2/12-3h49:26'
'2013/2/12-3h59:26'
'2013/2/12-4h9:26'
'2013/2/12-4h19:26' };
ca2 = strrep( cac, 'h', ':' );
sdn = datenum( ca2, 'yyyy/mm/dd-HH:MM:ss' );
datestr( sdn, 'yyyy-mm-dd HH:MM:SS' )
returns
ans =
2013-02-12 03:49:26
2013-02-12 03:59:26
2013-02-12 04:09:26
2013-02-12 04:19:26
.
Hint 2:
doc textscan