Prev: Make a handle an incremental variable
Next: background image brightness changed after displaying contour
From: Matthew on 11 Aug 2010 22:27 I have a file (time.txt) of dates & times (looks like this): 01-Jan-09 722 02-Jan-09 723 03-Jan-09 723 04-Jan-09 723 05-Jan-09 723 06-Jan-09 723 07-Jan-09 723 08-Jan-09 723 09-Jan-09 723 10-Jan-09 723 11-Jan-09 723 12-Jan-09 723 13-Jan-09 723 14-Jan-09 723 15-Jan-09 722 16-Jan-09 722 17-Jan-09 722 18-Jan-09 722 19-Jan-09 721 Where it is DD-MMM-YY HMM day-Month-Year Hour-Minutes I need to load and convert (datenum) But I'm having a hard time getting the file loaded/imported. Any advice to save my sanity? Thanks, Matt
From: Robert on 12 Aug 2010 03:46
"Matthew " <marsenaultremove.this(a)usgs.gov> wrote in message <i3vm6a$gf$1(a)fred.mathworks.com>... > I have a file (time.txt) of dates & times (looks like this): > > 01-Jan-09 722 > 02-Jan-09 723 > 03-Jan-09 723 > 04-Jan-09 723 > 05-Jan-09 723 > 06-Jan-09 723 > 07-Jan-09 723 > 08-Jan-09 723 > 09-Jan-09 723 > 10-Jan-09 723 > 11-Jan-09 723 > 12-Jan-09 723 > 13-Jan-09 723 > 14-Jan-09 723 > 15-Jan-09 722 > 16-Jan-09 722 > 17-Jan-09 722 > 18-Jan-09 722 > 19-Jan-09 721 > > > Where it is DD-MMM-YY HMM > day-Month-Year Hour-Minutes > > I need to load and convert (datenum) > > But I'm having a hard time getting the file loaded/imported. > > Any advice to save my sanity? > > Thanks, > Matt you can use textscan to read the lines without a loop, and then convert your strings to numeric datetime format with datenum. before you convert you presumably would have to fix the hour to two digits with leading 0 where there's only one. after that a format string like 'dd-mmm-yy HHMM' would make datenum convert your data. Cheers, Robert |