-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrowplot.m
More file actions
36 lines (33 loc) · 843 Bytes
/
growplot.m
File metadata and controls
36 lines (33 loc) · 843 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
function h = growplot(x, y, varargin)
ax = gca;
lines = ax.Children;
n = length(x);
if nargin < 2
y = x;
x = [];
end
if length(y) ~= n
error 'x and y values must be of equal length';
end
if isempty(lines)
n = length(x);
for k = 1:n
if nargin >=3
plot(x(1), y(1), varargin{:});
else
plot(x(1), y(1));
end
end
else
warning off MATLAB:gui:array:InvalidArrayShape;
for k = 1:n
if ~isempty(x)
lines(k).XData = [lines(k).XData x(k)];
else
N = length(lines(k).XData);
lines(k).XData = [lines(k).XData N+1];
end
lines(k).YData = [lines(k).YData y(k)];
end
end
end