function index_dups = find_repeats (output) % % Function finds the same station and niskin bottle number in output and % calls these "duplicate" samples. % % want to find duplicates of % station number and niskin number % % II should be (number_duplicate, 2) array of the indeces of all duplicates % % Version 1: written for Clivar output files that had station, cast, niskin, etc. % Version 2: written for AOML files that have station, niskin, etc. % Output = % column 1 = output_sta % column 2 = output_niskin % column 3 = output_bottle (sample bottle number or run order number) % column 4 = output_twiceratio % column 5 = output_salinity % column 6 = output_quality % column 7 = output_cast % I_column_station = 1; I_column_niskin = 2; num_duplicates = 0; index_dups = []; for II = 1:length(output) i_check_sta = output(II,I_column_station); i_check_niskin = output(II,I_column_niskin); JJ = find(output(:,I_column_station) == i_check_sta & output(:,I_column_niskin) == i_check_niskin); if length(JJ) > 1 % found a duplicate num_duplicates = num_duplicates + 1; index_dups(:,num_duplicates) = JJ; end end if isempty(index_dups) fprintf(1,'\nNo Duplicates Found\n\n') else index_dups=unique(index_dups','rows'); end return;