-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_queue.m
32 lines (29 loc) · 1.01 KB
/
update_queue.m
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
% Camila Rosa (crs94 @GitHub), 2016
% Cristiano Alves (ishiikurisu @GitHub), 2016
% ------------
% update_queue: Updates the signal and the queue
% Usage: Input the name of the variable in which
% the signal is stored and the size of the
% window that on desires to select
% Inputs:
% data = [array] Variable in which the signal
% is stored
% wsize = [double] Size of the window
% Output:
% data = [array] Variable in which the updated
% signal is stored
% queue = [array] Window selected
% ------------
function [data, queue] = update_queue(data, wsize)
queue = zeros(1, wsize); % Create empty array
if length(data) == 0
queue = [];
else
if length(data) >= wsize
queue = data(1:wsize);
data = data((wsize+1):length(data));
elseif length(data) < wsize
queue = data(1:length(data));
data = data((wsize+1):length(data));
end
end