You are using .txt file which has numbers like 1,2,3, 4,...,19,20. That is comma separated numbers and in order to calculate mean and variance, you need to first skip comma. Here I have created one .txt file which has numbers with comma separated.
str = '78,72,64,66,49';
fileID = fopen('temperature.txt','w');
Now, execute code skipping comma (The extended ASCII code 44 represents the comma sign).
in_file = fopen( 'temperature.txt', 'r');
comma = char(44);
[x,count] = fscanf(in_file, [' %f' comma],[1,inf])
mean = sum(x)/count;
78 72 64 66 49
Now you can similarly calculate your variance.
Hope it helps to solve your problem.