function values = binnavigation(root, bins, platform) % BINNAVIGATION - bins rov navigation by depth % % Use as: values = binnavigation(root, bins, platform) % % Inputs: root = the root of the navigation directory (i.e. % tornado:/TEMPNAV % bins = the edges of the dpth bins in meters (see histc) % platform = the name of the platform (either 'all', 'vnta' or 'tibr'). % The default is 'all' VENTANA = 'vnta'; TIBURON = 'tibr'; if nargin < 3 | strcmp('all', platform) platform = [VENTANA; TIBURON]; end values = zeros(size(bins)); values = values(length(values - 1)); for h = 1:size(platform, 1) rov = platform(h, :); for i = 1989:2004 year = num2str(i); curDir = fullfile(root, year, rov); for j = 1:366 day = num2str(j); fileprefix = ['nav' year day rov]; file = fullfile(curDir, [fileprefix 'edited.txt']); if ~exist(file) file = fullfile(curDir, [fileprefix '.txt']); if ~exist(file) %fprintf(1, 'The file %s does not exist.\n', file); continue; end end fprintf(1, 'Processing %s\n', file); try v = binfile(readdlm(file, ','), bins); values = values + v; catch fprintf('FAILED!!!!\n'); end end end end function values = binfile(d, bins) % BINFILE - bins up the values from a file into depths presCol = find(strcmp(d.field, 'Pres')); latCol = find(strcmp(d.field, 'Lat')); depth = depth_(d.data(:, presCol), d.data(:, latCol)); values = histc(depth, bins);