blob: 7df3d4cdddf33ade7145f6a3192ca6bcf73b314a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
function avg = read_avg(name, vlen)
f = fopen(name, "rb");
s = zeros(1, vlen);
n = 0;
while (!feof(f))
t = fread(f, [2, vlen], "float");
if (size(t) == [2, vlen])
n = n+1;
c = t(1,:)+t(2,:)*j;
if (n > 10)
s = s+c;
endif
endif
endwhile
avg = s/(n-1);
fclose(f);
endfunction
|