summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/matlab/selfCheck.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/matlab/selfCheck.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/common/matlab/selfCheck.m')
-rw-r--r--SD-VBS/common/matlab/selfCheck.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/SD-VBS/common/matlab/selfCheck.m b/SD-VBS/common/matlab/selfCheck.m
new file mode 100644
index 0000000..55c8de8
--- /dev/null
+++ b/SD-VBS/common/matlab/selfCheck.m
@@ -0,0 +1,27 @@
1function ret = selfCheck(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, '%d');
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 %d\tObserved %d\n', i, in2(i), in1(i));
21 ret = -1;
22 break;
23 end
24 end
25
26end
27