% GETIMAGETIMES.M SCRIPT TO GENERATE TIMES FROM IMAGE FILE NAMES % % parse imagenex data file names to get the time stamps % analyze time % % Written by Marinna Martini 10/9/03 % U.S. Geological Survey, Woods Hole Field Center function [FanTime, PencilTime] = getimagetimes(RootDataDir, datayear); % things you need to set by hand to make this work, maybe I'll make it all % gui some day... settings.datayear = datayear; %RootDataDir = 'C:\projects\euro\701im\images_for_movies\'; % ask user to point to a directory of files %RootDataDir = uigetdir('c:\projects\euro\701im','Select the root directory with all the Imagenex files'); %RootDataDir = uigetdir('c:\instment\imagenex','Select the root directory with all the Imagenex files'); SubDataDir = dir(RootDataDir); Fanidx = 1; Pencilidx = 1; % go through each and parse for d=3:length(SubDataDir), % the first two are always . and .. disp(SubDataDir(d).name) % act only on directories if exist(fullfile(RootDataDir,SubDataDir(d).name)) == 7, DataFiles = dir(fullfile(RootDataDir,SubDataDir(d).name)); for f = 3:length(DataFiles), % disp(DataFiles(f).name) % name convention is S1111020.F50 = S1MMDDHH.?MM % where ? = F for fan or P for pencil a = sscanf(DataFiles(f).name,'S1%c%c%c%c%c%c.%c%c%c') mon = str2num(a(1:2)); day = str2num(a(3:4)); hr = str2num(a(5:6)); min = str2num(a(8:9)); datenum_sonar = datenum(2002,mon,day,hr,min,0); WhichSonar = a(7); if WhichSonar == 'F', % first, display the sonar image FanTime(Fanidx) = julian([settings.datayear mon day hr min 0]); FanDatenum=datenum([settings.datayear mon day hr min 0]); Fanidx = Fanidx+1; elseif WhichSonar == 'P', % first, display the sonar image PencilTime(Pencilidx) = julian([settings.datayear mon day hr min 0]); Pencilidx = Pencilidx+1; end end end % clf; end