home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / FIGTEXT.M < prev    next >
Encoding:
Text File  |  1993-03-25  |  911 b   |  36 lines

  1. function H = figtext(x,y,T,justify)
  2. %FIGTEXT Place text in figure window.
  3. %    FIGTEXT(x,y,T) writes T, left justified, with the lower left
  4. %    corner at figure normalized coordinates (x,y).
  5. %    FIGTEXT(x,y,T,'center') and FIGTEXT(x,y,T,'right') are also possible.
  6. %    H = FIGTEXT(...) returns a vector of handles to the lines of text.
  7.  
  8. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  9.  
  10. if nargin < 4, justify = 'left'; end
  11.  
  12. kids = get(gcf, 'children');
  13. axis_exists = 0;
  14. for i=1 : size(kids,1)
  15.    if strcmp (get(kids(i), 'type') , 'axes')
  16.       if (get(kids(i), 'pos') == [0 0 1 1])
  17.             axes(kids(i));
  18.             axis_exists = 1;
  19.       end;
  20.    end;
  21. end;
  22. if (axis_exists == 0)
  23.     axes('pos', [0 0 1 1], 'vis', 'off');
  24. end;
  25.  
  26. dely = .04;
  27. [m,n] = size(T);
  28. for k = m:-1:1
  29.    h(k) = text(x,y,T(k,:),'horiz',justify, 'erase', 'back');
  30.    y = y + dely;
  31. end
  32.  
  33. if nargout > 0
  34.    H = h';
  35. end
  36.