example

in file a, data is [1 , 2, 3; 4,5,6]

file b, data is  [4,5, 6; 7,8,9]

average=0.5 (a+b)

matlab code

n=;
a=[];
b=[];
c=[];
% for loop
for i=:n
filename=sprintf('output_%d.dat',i);
fileinfo = importdata(filename);
ux=fileinfo.data(:,); % extract column data
uy=fileinfo.data(:,);
uz=fileinfo.data(:,);
a=[a,ux]; % put all Ux in an array
b=[b,uy];
c=[c,uz]; end
aver_Ux=sum(a,)/n; % sum of array elements
aver_Uy=sum(b,)/n; aver_Uz=sum(c,)/n;
05-17 12:21