-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathplot_discont.m
More file actions
29 lines (29 loc) · 799 Bytes
/
Copy pathplot_discont.m
File metadata and controls
29 lines (29 loc) · 799 Bytes
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
function [tspan] = plot_discont(times, dt)
% times = [1 3 4 6 7 10 11 13]';
% dt = 2;
% discont_proc(times,times,dt)
tspan = [];
j = 1;
while j <= length(times)
idx = find(times-times(j) <= dt & times-times(j) >= 0);
% if ~isempty(idx)
% tt = [times(j);times(idx)];
% tt = [tt(1);tt(end)];
% j = idx(end)+1;
% else
% tt = [times(j);times(j)];
% j = j+1;
% end
tt = [times(j); times(idx)];
tt = [tt(1); tt(end)];
j = idx(end) + 1;
% tspan = [tspan;tt;NaN;NaN];
tspan = [tspan; tt];
end
odd = tspan(1:2:end);
even = tspan(2:2:end);
tspan_new = [odd, even];
% plot(tspan,'-');
% datetick('y','HH:MM','keeplimits');
close;
end