time   | Calls   |  line  | 
|---|
 |  |    1   | function varargout = view(varargin)
   | 
 |  |    2   | %VIEW   3-D graph viewpoint specification.
   | 
 |  |    3   | %   VIEW(AZ,EL) and VIEW([AZ,EL]) set the angle of the view from which an
   | 
 |  |    4   | %   observer sees the current 3-D plot.  AZ is the azimuth or horizontal
   | 
 |  |    5   | %   rotation and EL is the vertical elevation (both in degrees). Azimuth
   | 
 |  |    6   | %   revolves about the z-axis, with positive values indicating counter-
   | 
 |  |    7   | %   clockwise rotation of the viewpoint. Positive values of elevation
   | 
 |  |    8   | %   correspond to moving above the object; negative values move below.
   | 
 |  |    9   | %   VIEW([X Y Z]) sets the view angle in Cartesian coordinates. The
   | 
 |  |   10   | %   magnitude of vector X,Y,Z is ignored.
   | 
 |  |   11   | %
   | 
 |  |   12   | %   Here are some examples:
   | 
 |  |   13   | %
   | 
 |  |   14   | %   AZ = -37.5, EL = 30 is the default 3-D view.
   | 
 |  |   15   | %   AZ = 0, EL = 90 is directly overhead and the default 2-D view.
   | 
 |  |   16   | %
   | 
 |  |   17   | %   VIEW(2) sets the default 2-D view, AZ = 0, EL = 90.
   | 
 |  |   18   | %   VIEW(3) sets the default 3-D view, AZ = -37.5, EL = 30.
   | 
 |  |   19   | %
   | 
 |  |   20   | %   [AZ,EL] = VIEW returns the current azimuth and elevation.
   | 
 |  |   21   | %
   | 
 |  |   22   | %   VIEW(AX,...) uses axes AX instead of the current axes.
   | 
 |  |   23   | %
   | 
 |  |   24   | %   See also VIEWMTX.
   | 
 |  |   25   | 
 
  | 
 |  |   26   | %   Copyright 1984-2018 The MathWorks, Inc.
   | 
 |  |   27   | 
 
  | 
< 0.001   |       2   |   28  | narginchk(0,3); 
   | 
< 0.001   |       2   |   29  | nargoutchk(0, 2); 
   | 
 |  |   30   | 
 
  | 
 |  |   31   | %
   | 
 |  |   32   | % determine which axes the view is to be applied to, as well as what the
   | 
 |  |   33   | % input arguments to ViewCore are going to be
   | 
 |  |   34   | %
   | 
< 0.001   |       2   |   35  | viewArgs = {}; 
  | 
< 0.001   |       2   |   36  | switch nargin 
   | 
< 0.001   |       2   |   37  |  case 0 
   | 
 |  |   38   |   hAxes = gca;
   | 
 |  |   39   |   
   | 
< 0.001   |       2   |   40  |  case { 1, 2 } 
  | 
  0.001   |       2   |   41  |   if isAxesHandle(varargin{1}) 
  | 
< 0.001   |       2   |   42  |     hAxes = varargin{1}; 
  | 
< 0.001   |       2   |   43  |     viewArgs = varargin(2:end); 
   | 
 |  |   44   |   else
   | 
 |  |   45   |     hAxes = gca;
   | 
 |  |   46   |     viewArgs = varargin(1:end);
   | 
< 0.001   |       2   |   47  |   end 
   | 
 |  |   48   |   
   | 
 |  |   49   |  case 3
   | 
 |  |   50   |   if ~isAxesHandle(varargin{1})
  | 
 |  |   51   |     error(message('MATLAB:view:InvalidFirstArgument'));
  | 
 |  |   52   |   else
   | 
 |  |   53   |     hAxes = varargin{1};
  | 
 |  |   54   |     viewArgs = varargin(2:end);
   | 
 |  |   55   |   end
   | 
< 0.001   |       2   |   56  | end 
   | 
 |  |   57   | 
 
  | 
< 0.001   |       2   |   58  | if isa(hAxes,'matlab.graphics.chart.Chart') 
   | 
 |  |   59   |     %view not supported by charts. Defer to chart for error message
   | 
 |  |   60   |     try
   | 
 |  |   61   |         hAxes.view(varargin);
   | 
 |  |   62   |     catch e
   | 
 |  |   63   |         throw(e)
   | 
 |  |   64   |     end
   | 
 |  |   65   |     return
   | 
< 0.001   |       2   |   66  | end 
   | 
 |  |   67   | 
 
  | 
 |  |   68   | %
   | 
 |  |   69   | % set the view
   | 
 |  |   70   | %
   | 
< 0.001   |       2   |   71  | if ~isempty(viewArgs) 
   | 
< 0.001   |       2   |   72  |   if(~all(isnumeric([viewArgs{:}]))) 
  | 
 |  |   73   |     error(message('MATLAB:view:InvalidInputs'));
  | 
< 0.001   |       2   |   74  |   end 
   | 
  0.006   |       2   |   75  |   ViewCore(hAxes, viewArgs{:}); 
  | 
< 0.001   |       2   |   76  | end 
   | 
 |  |   77   | 
 
  | 
 |  |   78   | %
   | 
 |  |   79   | % construct the return args, return the azimuth and elevation for 2 lhs args,
   | 
 |  |   80   | % otherwise, return the transformation matrix
   | 
 |  |   81   | %
   | 
< 0.001   |       2   |   82  | switch nargout 
   | 
< 0.001   |       2   |   83  |     case {0,1} 
  | 
< 0.001   |       2   |   84  |         if( nargin == 0 || nargout == 1) 
   | 
 |  |   85   |             % If VIEW is called without any input
   | 
 |  |   86   |             % arguments, then it is treated as a query
   | 
 |  |   87   |             % command. In which case always return the
   | 
 |  |   88   |             % view matrix.
   | 
 |  |   89   |             % If one output argument is specified, always
   | 
 |  |   90   |             % return the view matrix.
   | 
 |  |   91   |             assert(isa(hAxes, 'matlab.graphics.axis.Axes'), ...
   | 
 |  |   92   |                 message('MATLAB:view:OneOutputNotSupported'))
  | 
 |  |   93   |             varargout{1} = getAxesTransformationMatrix(hAxes);
  | 
< 0.001   |       2   |   94  |         end 
   | 
 |  |   95   |     case 2
   | 
 |  |   96   |         axView = get(hAxes, 'View');
   | 
 |  |   97   |         varargout{1} = axView(1);
  | 
 |  |   98   |         varargout{2} = axView(2);
  | 
< 0.001   |       2   |   99  | end 
   | 
Other subfunctions in this file are not included in this listing.