%GALTON_HEIGHTS: MATLAB script M-file that defines
%Galton's original data from the .csv file
%Galton_Data.csv. 
%First, import the data as a table
T=readtable('Galton_Data.csv');
%NOTE: On some systems, entries in Galton_Data.csv need 
%to be converted from strings to double precision values.
%For this, exchange the specifications for mother, father,
%and child with its alternative line in the code below.
%Mother heights
mother = T.Mother;
%mother = str2double(T.Mother);
%Father heigths
father = T.Father;
%father = str2double(T.Father);
%Child heights
child = T.Height;
%child = str2double(T.Height);
%Gender
gender = T.Gender;
%Galton multiplied the height of each female 
%child by 1.08. We can accomplish this as follows:
for k=1:length(gender)
    if isequal(gender(k),{'F'}) == 1
        child(k) = 1.08*child(k);
    end
end
midheight = (father+1.08*mother)/2;
