forked from qiuzhihui/csma_simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_line.m
More file actions
55 lines (32 loc) · 716 Bytes
/
plot_line.m
File metadata and controls
55 lines (32 loc) · 716 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function plot_line
global plot_flag;
n=size(plot_flag,1);
xline=zeros(n,100);
yline=zeros(n,100);
for i=1:n
if plot_flag(i,1)==1
if plot_flag(i,2)==1
type='y';
else
type='g';
end
h(i) = animatedline('Color',type,'LineWidth',3);
xline(i,:) = linspace(plot_flag(i,3),plot_flag(i,5),100);
yline(i,:) = linspace(plot_flag(i,4),plot_flag(i,6),100);
end
end
for k = 1:100
for i=1:n
if plot_flag(i,1)==1
addpoints(h(i),xline(i,k),yline(i,k));
drawnow
end
end
end
for i=1:n
if plot_flag(i,1)==1
clearpoints(h(i))
end
end
plot_flag=zeros(n+1,6);
end