forked from yueyuzhao/gyrophone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge_signals.m
More file actions
22 lines (20 loc) · 810 Bytes
/
merge_signals.m
File metadata and controls
22 lines (20 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function [merged_timestamps, merged_signals] = ...
merge_signals(sig, offset)
% Merge two signals sample-by-sample given the samples and offsets
num_signals = length(sig);
timestamps = cell(num_signals, 1);
for i = 1:length(sig)
timestamps{i} = offset(i):offset(i)+length(sig{i}) - 1;
end
if num_signals == 2
[merged_timestamps, merged_signals] = ...
merge_samples(timestamps{1}, sig{1}, ...
timestamps{2}, sig{2});
elseif length(sig) == 4
[merged_timestamps, merged_signals] = ...
merge_samples4(timestamps{1}, sig{1}, ...
timestamps{2}, sig{2}, ...
timestamps{3}, sig{3}, ...
timestamps{4}, sig{4});
end
end