-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtesting.m
More file actions
116 lines (77 loc) · 3.34 KB
/
testing.m
File metadata and controls
116 lines (77 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
function testing(signalAddress,signalListAddress,timingContstraintContent,samplingTime)
disp('testing func');
disp(signalAddress);
disp(timingContstraintContent);
close all
thetime = [];
% ttlFileAddress = 'D:\GoogleDrive\ASU\Research\TimeTesting\TTL\Tool\inputcode1.txt';
% signalListFileAddress = 'D:\GoogleDrive\ASU\Research\TimeTesting\TTL\Tool\signalList.txt';
% signalValueFileAddress = 'D:\GoogleDrive\ASU\Research\TimeTesting\TTL\Tool\Signals.xlsx';
signalListFileAddress = signalListAddress;
signalValueFileAddress = signalAddress;
% [pTree,signalTstamps,startTime,stopTime] = Parse(ttlFileAddress,signalListFileAddress,signalValueFileAddress);
[pTree,signalTstamps,startTime,stopTime] = Parse(timingContstraintContent,signalListFileAddress,signalValueFileAddress);
% How many leaves exist
signalTstmpBckUp = signalTstamps;
aliveRows = size(signalTstamps);
aliveNodes = aliveRows(1);
% calculation of the number of nodes
pTreeNodes = nnodes(pTree);
% getting the number of alive nodes at first to plot all signals properly
firstAliveNodes = aliveNodes;
% Calculating the number of operator nodes.
numberofOperators = pTreeNodes - aliveNodes;
allTimestamps = signalTstamps(:,1);
% The number of plots. At least we should plot one plot and based on number
% of nodes, it is increamented.
plotNum = 1;
% disp(signalTstamps{1,3});
% disp(signalTstamps{1,4});
% disp(signalTstamps{2,3});
% disp(signalTstamps{2,4});
while(allTimestamps{1,1}~=1)
% disp('The First row');
tempRow = signalTstamps(1,:);
currentNodeSiblings = getsiblings(pTree,allTimestamps{1,1});
n = (size(currentNodeSiblings,2));
siblingsIndices = zeros(1,size(currentNodeSiblings,2));
for i=1:size(currentNodeSiblings,2)
aSibling = currentNodeSiblings(1,i);
for j=1:size(allTimestamps,1)
if (aSibling==allTimestamps{j})
siblingsIndices(i)=j;
end
end
end
if(size(find(siblingsIndices==0),2)== 0)
currentOperator = getparent(pTree, currentNodeSiblings(1,1));
operatorContent = get(pTree, currentOperator);
operatorInput=[];
for i=1:size(siblingsIndices,2)
operatorInput = [operatorInput;signalTstamps(siblingsIndices(1,i),:)];
end
signalTstamps = removerows(signalTstamps,siblingsIndices);
calculatedTs = callingFunc(currentOperator,operatorContent,operatorInput,startTime,stopTime,pTree,samplingTime);
plotFunc(calculatedTs,startTime,stopTime,numberofOperators,plotNum,pTree,operatorContent,currentOperator);
plotNum = plotNum + 1;
signalTstamps = [signalTstamps;calculatedTs];
else
% disp('NO');%remove the first row form signalTstamps and add it to its tail
signalTstamps = removerows(signalTstamps,1);
signalTstamps = [signalTstamps;tempRow];
end
aliveRows = size(signalTstamps);
aliveNodes = aliveRows(1);
allTimestamps = signalTstamps(:,1);
% preparing the plot for drawing the next one
end
%%%%%%%%%%%%%%%%%%%%%%%%
% xx=[ones(1,signalTstamps{4}(1)-signalTstamps{3}(1)) zeros(1,signalTstamps{3}(2)-signalTstamps{4}(1)) ones(1,signalTstamps{4}(2)-signalTstamps{3}(2))]
% figure
% plot(xx,'-*')
% axis([0 length(xx) -1 2])
%%%%%%%%%%%%%%%%%%%%%%%
disp('Final Timestamps');
disp(signalTstamps{3});
disp(signalTstamps{4});
end