time | Calls | line |
---|
| | 1 | function ret_ax = cla(varargin)
|
| | 2 | %CLA Clear current axis.
|
| | 3 | % CLA deletes all children of the current axes with visible handles and resets
|
| | 4 | % the current axes ColorOrder and LineStyleOrder..
|
| | 5 | %
|
| | 6 | % CLA RESET deletes all objects (including ones with hidden handles)
|
| | 7 | % and also resets all axes properties, except Position and Units, to
|
| | 8 | % their default values.
|
| | 9 | %
|
| | 10 | % CLA(AX) or CLA(AX,'RESET') clears the single axes with handle AX.
|
| | 11 | %
|
| | 12 | % See also CLF, RESET, HOLD.
|
| | 13 |
|
| | 14 | % CLA(..., HSAVE) deletes all children except those specified in
|
| | 15 | % HSAVE.
|
| | 16 |
|
| | 17 | % Copyright 1984-2016 The MathWorks, Inc.
|
| | 18 |
|
| | 19 | % Check for an Axes handle.
|
| | 20 | % 'isgraphics' will catch numeric graphics handles, but will not catch
|
| | 21 | % deleted graphics handles, so we need to check for both separately.
|
< 0.001 | 2 | 22 | if nargin > 0 && (...
|
| 2 | 23 | (isscalar(varargin{1}) && ...
|
| 2 | 24 | (isgraphics(varargin{1},'axes') || isgraphics(varargin{1},'polaraxes'))) ...
|
| | 25 | || isa(varargin{1},'matlab.graphics.axis.AbstractAxes'))
|
| | 26 | % If first argument is an axes handle
|
< 0.001 | 2 | 27 | ax = varargin{1};
|
< 0.001 | 2 | 28 | extra = varargin(2:end);
|
| | 29 | else
|
| | 30 | % Default target is current axes
|
| | 31 | ax = gca;
|
| | 32 | extra = varargin;
|
< 0.001 | 2 | 33 | end
|
| | 34 |
|
| | 35 | % Check to make sure we have a valid scalar axes handle.
|
| | 36 | % Empty array of axes handles is a no-op.
|
| | 37 | % Vector of axes or deleted axes is an error.
|
< 0.001 | 2 | 38 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 39 | error(message('MATLAB:Chart:UnsupportedConvenienceFunction', 'cla', ax.Type));
|
< 0.001 | 2 | 40 | elseif isscalar(ax) && isgraphics(ax)
|
| | 41 | % Call claNotify to trigger cla related evants.
|
0.003 | 2 | 42 | claNotify(ax,extra{:});
|
| | 43 |
|
| | 44 | % Call clo on the axes
|
0.007 | 2 | 45 | clo(ax, extra{:});
|
| | 46 | elseif ~isempty(ax)
|
| | 47 | error(message('MATLAB:cla:InvalidAxesHandle'));
|
| | 48 | end
|
| | 49 |
|
| | 50 | % Return the axes handle if requested
|
< 0.001 | 2 | 51 | if (nargout ~= 0)
|
| | 52 | ret_ax = ax;
|
| | 53 | end
|
Other subfunctions in this file are not included in this listing.