-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadSignals.m
More file actions
115 lines (74 loc) · 2.57 KB
/
readSignals.m
File metadata and controls
115 lines (74 loc) · 2.57 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
function [activeLeaves,startTime,stopTime] = readSignals (ttlTree, treeLeaves,signalListFile,signalsValueFile)
signalsListFileID = fopen(signalListFile);
signalList = strsplit(string(fgetl(signalsListFileID)));
% disp(signalList(4));
numbersCell = {[],[],[],[]};
% disp(size(numbersCell));
dim = size(treeLeaves,2);
% disp(dim);
signalValue = xlsread(signalsValueFile) ;
t = readtable(signalsValueFile);
[rows, columns] = size(t);
% disp('readSignal Func');
% disp(rows);
% disp(columns);
% disp(signalValue(1,:));
% timestamps in the signal file.
timeList = signalValue(:,1);
startTime = timeList(1);
stopTime = timeList(length(timeList));
% disp('readSignal Func');
% disp(rows);
% disp(columns);
% disp(timeList);
for i= 1: dim
nodeValue = get(ttlTree,treeLeaves(i));
switch nodeValue(1)
case {'0','1','2','3','4','5','6','7','8','9','.','-','+'}
tag = 1;
numbersCell = [numbersCell;{treeLeaves(i),tag,nodeValue,-1}];
% numbersCell={treeLeaves(i)}
% tempNode = dlnode(treeLeaves(i),tag,nodeValue);
%
% xx = lastNode(activeLeaves);
% % dispOneNode(xx);
%
% activeLeaves = insertAfter(tempNode,xx);
% % displ(activeLeaves);
case {'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m','Q','W','R','T','Y','I','O','A','H','J','K','Z','X','V','N','M'}
tag = 2;
A = find(strcmp(nodeValue,signalList));
numbersCell = [numbersCell;{treeLeaves(i),tag,signalValue(:,1),signalValue(:,A)}];
% signalValue(:,A)
% plot(signalValue(:,A));
% tempNode = dlnode(treeLeaves(i),tag,signalValue(:,1),signalValue(:,A));
%
% xx = lastNode(activeLeaves);
% activeLeaves = insertAfter(tempNode,xx);
% case {'U','G','E','L','S','C','F','P','B','#','^','<','>','='}
% tag = 3;
%
% case 'D'
% tag = 4;
otherwise
;
end
end
% disp(numbersCell);
% disp(numbersCell{2,3});
% numbersCell = [numbersCell{1,:}];
% disp(numbersCell);
% x = signalsCell{:,1};
% disp (x);
numbersCell = [numbersCell(2:end,:)];
activeLeaves = numbersCell;
% fileID = fopen('D:\GoogleDrive\ASU\Research\TimeTesting\TTL\Tool\Signals.xlsx');
%
% signalsFileID = fopen('D:\GoogleDrive\ASU\Research\TimeTesting\TTL\Tool\signals.txt');
%
%
% C = textscan(fileID,'%f %f %f %f');
% fclose(fileID);
% whos C
fclose('all');
end