Are you saying that if some day has duplicates, you want to replace them with the mean of the bunch? Like 3 values of 100, 101, and 102 for day #320 would go to only 1 value of 102 for that day?
Why can't you just scan over the days and find out which one has multiples and then delete the unneeded ones? Let's say you found that elements 40,41, and 42 were all for day #320, so you could do
newMean = mean(theMeans(40:42));
newSD = std(theSDs(40:42));
theMeans(40) = newMean;
theSDs(40) = newSD;
themeans(41) = [];
theSds(41) = [];
themeans(42) = [];
theSds(42) = [];