Rev | Line | |
---|
[37] | 1 | function h = mobile_text(varargin) |
---|
| 2 | % MOBILE_TEXT('str1', 'str2', ...) places each string in a random position |
---|
| 3 | % on the current axes. The strings can be dragged around with the mouse. |
---|
| 4 | % Returns handles to the text objects, for setting colors, etc. |
---|
| 5 | |
---|
| 6 | strs = varargin; |
---|
| 7 | n = length(strs); |
---|
| 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 text(x(i),y(i),strs{i})]; |
---|
| 15 | end |
---|
| 16 | set(h,'ButtonDownFcn','move_obj(1)'); |
---|
| 17 | if nargout == 0 |
---|
| 18 | clear h |
---|
| 19 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.