0
|
1 % Takes a variable number of points as inputs and plots them with a label to the current figure.
|
|
2 % label_pt(p)
|
|
3 function label_pt(varargin)
|
|
4 for i = 1:length(varargin)
|
|
5 try
|
|
6 placelabel(varargin{i},inputname(i));
|
|
7 catch e
|
|
8 error('Could not place label for input %d, ''%s''. Not a valid point',i,inputname(i))
|
|
9 end
|
|
10 end
|
|
11 end
|
|
12
|
|
13 function placelabel(pt,str)
|
|
14 x = pt(1);
|
|
15 y = pt(2);
|
|
16 h = line(x,y);
|
|
17 h.Marker = '.';
|
|
18 h = text(x,y,str);
|
|
19 h.HorizontalAlignment = 'center';
|
|
20 h.VerticalAlignment = 'bottom';
|
|
21 end |