function [Yon,Uon,Ysel,Usel] = axisvis(RespObj)
%AXISVIS  Return coordinates of visible and selected LTI Display Axes.
%
%   The visible axes are RespObj.PlotAxes(Yon,Uon).
%   The selected axes (I/O channels) are RespObj.PlotAxes(Ysel,Usel)

%   Author(s): P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.2 $  $Date: 2000/06/14 20:07:54 $

LTIdisplayAxes = RespObj.PlotAxes;
AxesGrouping = RespObj.AxesGrouping;
BodeMarg = any(strcmp(RespObj.ResponseType,{'bode','margin'}));

%---Get selected input and output channels from Channel selector
Usel = find(any(RespObj.SelectedChannels,1));
Ysel = find(any(RespObj.SelectedChannels,2));

%---Adjust the number of axes for special response types
if BodeMarg,
   Ysel = sort([(2*Ysel)-1; 2*Ysel]);
end

%---Determine required grid of axis (Uon = columns of PlotAxes to keep)
switch AxesGrouping
case 'none', % No grouping
   Uon = Usel;
   Yon = Ysel;
case 'all',  % Group all
   Uon = 1;
   if BodeMarg
      Yon = [1;2];
   else
      Yon = 1;
   end
case 'inputs',  % Group inputs
   Uon = 1;
   Yon = Ysel;
case 'outputs', % Group outputs
   Uon = Usel;
   if BodeMarg
      Yon = [1;2];
   else
      Yon = 1;
   end
end
