function day_sec = get_time_from_fname( fname ) % Simple routine to return a time from a filename. % Returns the number of seconds from the start of a day. % fname = deblank(char(fname)); junk = regexp(fname,'/','split'); fname = char(junk(size(junk,2))); fparts = regexp(fname,'\.','split'); dtype = char(fparts(1)); switch dtype case 'swp'; dstr = char(fparts(2)); tm = sscanf(dstr,'%03d%02d%02d%02d%02d%02d'); day_sec = tm(4) * 3600 + tm(5) * 60 + tm(6); case 'cfrad'; % there are two ways of naming cfradial files if( regexp(char(fname),'_to_') ) fparts = regexp(fname,'_to_','split'); fparts = regexp(char(fparts(2)),'\.','split'); tstr = regexp(char(fparts(1)),'_','split'); dstr = char(tstr(2)); tm = sscanf(dstr,'%02d%02d%02d'); day_sec = tm(1) * 3600 + tm(2) * 60 + tm(3); else tstr = regexp(char(fparts(2)),'_','split'); dstr = char(tstr(2)); tm = sscanf(dstr,'%02d%02d%02d'); day_sec = tm(1) * 3600 + tm(2) * 60 + tm(3); end; otherwise end;