function [totalsum,average] = stats_error (input_vector)
% STATS_ERROR - Calculates cumulative total & average
totalsum = sum(input_vector);
average = ourmean(input_vector);

function y = ourmean (x)
% OURMEAN - Calculates average
[m,n] = size(x);
if m == 1
   m = n;
end
y = sum(input_vector)/m;