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

  1. function hold(opt_hold_state);
  2. %HOLD    Hold the current graph.
  3. %     HOLD ON holds the current plot and all axis properties so that
  4. %    subsequent graphing commands add to the existing graph.
  5. %     HOLD OFF returns to the default mode whereby PLOT commands erase 
  6. %     the previous plots and reset all axis properties before drawing 
  7. %    new plots.
  8. %     HOLD, by itself, toggles the hold state.
  9. %     HOLD does not affect axis autoranging properties.
  10. %
  11. %    Algorithm note:
  12. %    HOLD ON sets the NextPlot property of the current figure and
  13. %    axes to "add".
  14. %    HOLD OFF sets the NextPlot property of the current axes to
  15. %    "replace".
  16. %
  17. %    See also ISHOLD, NEWPLOT, FIGURE, AXES.
  18.  
  19. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  20.  
  21. ax = gca;
  22. nexta = lower(get(ax,'NextPlot'));
  23. nextf = lower(get(gcf,'NextPlot'));
  24. hold_state = strcmp(nexta,'add') & strcmp(nextf,'add');
  25. if(nargin == 0)
  26.     if(hold_state)
  27.         set(ax,'NextPlot','replace');
  28.         disp('Current plot released');
  29.     else
  30.         set(ax,'NextPlot','add');
  31.         disp('Current plot held');
  32.     end
  33. elseif(strcmp(opt_hold_state, 'on'))
  34.     set(gcf,'NextPlot','add');
  35.     set(ax,'NextPlot', 'add');
  36. elseif(strcmp(opt_hold_state, 'off'))
  37.     set(ax,'NextPlot', 'replace');
  38. else
  39.     error('Unknown command option.');
  40. end
  41.