summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/matlab/fSelfCheck.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/matlab/fSelfCheck.m')
-rw-r--r--SD-VBS/common/matlab/fSelfCheck.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/SD-VBS/common/matlab/fSelfCheck.m b/SD-VBS/common/matlab/fSelfCheck.m
new file mode 100644
index 0000000..0288328
--- /dev/null
+++ b/SD-VBS/common/matlab/fSelfCheck.m
@@ -0,0 +1,27 @@
1function ret = fSelfCheck(in1, path, tol)
2
3r1 = size(in1, 1);
4c1 = size(in1, 2);
5
6ret = 1;
7
8file = [path, '/expected.m'];
9fd = fopen(file, 'r');
10
11[in2, count] = fscanf(fd, '%f');
12
13if(count ~= (r1*c1) )
14 fprintf(1, 'Dimensions mismatch: Expected %d\t Observed %d\n', count, (r1*c1));
15 ret = -1;
16else
17 ret = 1;
18 for i=1:(r1*c1)
19 if( (abs(in1(i)) - abs(in2(i)) > tol) || (abs(in2(i)) - abs(in1(i))) > tol)
20 fprintf(1, 'Checking Error: Index %d\tExpected %f\tObserved %f\n', i, in2(i), in1(i));
21 ret = -1;
22 break;
23 end
24 end
25
26end
27