Rev | Line | |
---|
[37] | 1 | function h = mobile_points(n, linespec) |
---|
| 2 | % Places n random points in the style given by linespec (e.g. 'bo'). |
---|
| 3 | % Points can be dragged with the mouse. |
---|
| 4 | |
---|
| 5 | if nargin < 2 |
---|
| 6 | linespec = 'o'; |
---|
| 7 | end |
---|
| 8 | ax = axis; |
---|
| 9 | % random placement |
---|
| 10 | x = rand(1,n)*(ax(2)-ax(1)) + ax(1); |
---|
| 11 | y = rand(1,n)*(ax(4)-ax(3)) + ax(3); |
---|
| 12 | h = []; |
---|
| 13 | for i = 1:n |
---|
| 14 | h = [h line(x(i), y(i), 'linestyle', 'none')]; |
---|
| 15 | end |
---|
| 16 | set_linespec(h,linespec); |
---|
| 17 | set(h, 'ButtonDownFcn', 'move_obj(1)'); |
---|
| 18 | if nargout < 1 |
---|
| 19 | clear h; |
---|
| 20 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.