time | Calls | line |
---|
| | 1 | function ret_ax = cla(varargin)
|
| | 2 | %CLA Clear current axes.
|
| | 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-2018 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.
|
| | 22 |
|
< 0.001 | 12 | 23 | if nargin > 0
|
< 0.001 | 12 | 24 | [varargin{:}] = convertStringsToChars(varargin{:});
|
< 0.001 | 12 | 25 | end
|
| | 26 |
|
0.001 | 12 | 27 | if nargin > 0 && (...
|
| 12 | 28 | (isscalar(varargin{1}) && ...
|
| 12 | 29 | (isgraphics(varargin{1},'axes') || isgraphics(varargin{1},'polaraxes'))) ...
|
| | 30 | || isa(varargin{1},'matlab.graphics.axis.AbstractAxes'))
|
| | 31 | % If first argument is an axes handle
|
< 0.001 | 12 | 32 | ax = varargin{1};
|
< 0.001 | 12 | 33 | extra = varargin(2:end);
|
| | 34 | else
|
| | 35 | % Default target is current axes
|
| | 36 | ax = gca;
|
| | 37 | extra = varargin;
|
< 0.001 | 12 | 38 | end
|
| | 39 |
|
| | 40 | % Check to make sure we have a valid scalar axes handle.
|
| | 41 | % Empty array of axes handles is a no-op.
|
| | 42 | % Vector of axes or deleted axes is an error.
|
< 0.001 | 12 | 43 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 44 | error(message('MATLAB:Chart:UnsupportedConvenienceFunction', 'cla', ax.Type));
|
< 0.001 | 12 | 45 | elseif isa(ax, 'matlab.ui.control.UIAxes')
|
| | 46 | cla(ax, extra{:});
|
< 0.001 | 12 | 47 | elseif isscalar(ax) && isgraphics(ax)
|
| | 48 | % Call claNotify to trigger cla related evants.
|
0.009 | 12 | 49 | claNotify(ax,extra{:});
|
| | 50 |
|
| | 51 | % Call clo on the axes
|
0.038 | 12 | 52 | clo(ax, extra{:});
|
| | 53 | elseif ~isempty(ax)
|
| | 54 | error(message('MATLAB:cla:InvalidAxesHandle'));
|
< 0.001 | 12 | 55 | end
|
| | 56 |
|
| | 57 | % Return the axes handle if requested
|
< 0.001 | 12 | 58 | if (nargout ~= 0)
|
| | 59 | ret_ax = ax;
|
< 0.001 | 12 | 60 | end
|
Other subfunctions in this file are not included in this listing.