home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / PLOTXY.DI$ / GTEXT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  971 b   |  37 lines

  1. function hh=gtext(string)
  2. %GTEXT    Place text on a 2-D graph using a mouse.
  3. %    GTEXT('string') displays the graph window, puts up a
  4. %    cross-hair, and waits for a mouse button or keyboard key to be
  5. %    pressed.  The cross-hair can be positioned with the mouse (or
  6. %    with the arrow keys on some computers).  Pressing a mouse button
  7. %    or any key writes the text string onto the graph at the selected
  8. %    location.  
  9. %
  10. %    See also TEXT, GINPUT.
  11.  
  12. %    L. Shure, 12-01-88.
  13. %    Revised: Charles D. Packard 3-8-89
  14. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  15.  
  16. if nargin ~= 1
  17.    error('Not enough or too many input arguments.');
  18. end
  19. if ~isstr(string)
  20.    error('Argument must be a string.')
  21. end
  22. [az el] = view;
  23. if az ~= 0 | el ~= 90
  24.     error('View must be two-dimensional.')
  25. end
  26. [r,c]=size(string);
  27.  
  28. h = [];
  29. for rows=1:r
  30.    [x,y] = ginput(1);
  31.    ht = text(x,y,string(rows,:),'VerticalAlignment','baseline');
  32.    h = [ht; h];
  33. end
  34. if nargout > 0
  35.    hh = h;
  36. end
  37.