Reading measurements from a file and calculating mean value