summaryrefslogtreecommitdiff
path: root/gr-radar-mono/src/utils/read_avg_sec.m
diff options
context:
space:
mode:
authorjcorgan2007-09-28 21:44:05 +0000
committerjcorgan2007-09-28 21:44:05 +0000
commit554380de440aed0dd2c20c1c394e15c770802b2d (patch)
treef63caace2024a43d2eebaeaa86fa8dc1548e44b5 /gr-radar-mono/src/utils/read_avg_sec.m
parentea8558daa6d9afa7dea13fe0adf7acbac4e5d352 (diff)
downloadgnuradio-554380de440aed0dd2c20c1c394e15c770802b2d.tar.gz
gnuradio-554380de440aed0dd2c20c1c394e15c770802b2d.tar.bz2
gnuradio-554380de440aed0dd2c20c1c394e15c770802b2d.zip
Merged r6552:6562 from jcorgan/radar into trunk. Updates gr-radar-mono with changes from live field testing.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6563 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-radar-mono/src/utils/read_avg_sec.m')
-rw-r--r--gr-radar-mono/src/utils/read_avg_sec.m25
1 files changed, 25 insertions, 0 deletions
diff --git a/gr-radar-mono/src/utils/read_avg_sec.m b/gr-radar-mono/src/utils/read_avg_sec.m
new file mode 100644
index 000000000..7aa77675d
--- /dev/null
+++ b/gr-radar-mono/src/utils/read_avg_sec.m
@@ -0,0 +1,25 @@
+function avg = read_avg_sec(name, vlen)
+
+ f = fopen(name, "rb");
+ s = zeros(1, vlen);
+ n = 0;
+ m = 0;
+
+ while (!feof(f))
+ t = fread(f, [2, vlen], "float");
+ if (size(t) == [2, vlen])
+ n = n+1;
+ c = t(1,:)+t(2,:)*j;
+ s = s+c;
+ m = m+1;
+ if (m == 1000)
+ avg(n/1000,:) = s/1000;
+ s = zeros(1, vlen);
+ m = 0;
+ endif
+ endif
+ endwhile
+
+ fclose(f);
+
+endfunction