function [UniqueValues , Means] = ProcessCTD_Data(filename,LoggedTime,CTD_epoch,CTD_temp,CTD_cond)

idx = find((CTD_epoch > 0));
CTD_epoch = CTD_epoch(idx);
CTD_temp = CTD_temp(idx);
CTD_cond = CTD_cond(idx);
LoggedTime = LoggedTime(idx);


[A,idx,ic] = unique(CTD_epoch);
clear A;
clear ic;

UniqueValues.CTD_epoch = CTD_epoch(idx);
UniqueValues.CTD_temp = CTD_temp(idx);
UniqueValues.CTD_cond = CTD_cond(idx);
UniqueValues.LoggedTime = LoggedTime(idx);


Means.epoch = mean(UniqueValues.CTD_epoch);
Means.cond = mean(UniqueValues.CTD_cond);
Means.temp = mean(UniqueValues.CTD_temp);
Means.LoggedTime = mean(UniqueValues.LoggedTime);

if(isOctave)
 save('-mat7-binary',[filename '_ctd.mat'],'UniqueValues','Means');
else
 save([filename '_ctd.mat'],'UniqueValues','Means');
end

end

