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

  1. function ret_ax = cla(opt_reset)
  2. %CLA     Clear axis.
  3. %     CLA deletes all objects (lines, text, patches, surfaces, and
  4. %    images) from the current axes.
  5. %    CLA RESET deletes everything and also resets all axis properties,
  6. %    except position, to their default values.
  7. %
  8. %    See also CLF, RESET, HOLD.
  9.  
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. ax = gca;
  13.  
  14. % Delete all axis children.
  15. kids = get(ax,'Children');
  16. for i = 1:max(size(kids))
  17.     delete(kids(i));
  18. end
  19. if (nargout ~= 0)
  20.     ret_ax = ax;
  21. end
  22.  
  23. % Do reset, if requested
  24. if nargin == 1 
  25.     if strcmp(opt_reset,'reset')
  26.         position = get(ax,'position');
  27.         reset(ax);
  28.         set(ax,'position',position);
  29.     else
  30.         error('Unknown command option.')
  31.     end
  32. elseif nargin > 1
  33.     error('Unknown command option.')
  34. end
  35.  
  36.  
  37.