Home > classes > @tsdata > get_xy_axis.m

get_xy_axis

PURPOSE ^

GET_XY_AXIS returns the x-axis and/or y-axis values.

SYNOPSIS ^

function varargout = get_xy_axis(data, pl)

DESCRIPTION ^

 GET_XY_AXIS returns the x-axis and/or y-axis values.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: GET_XY_AXIS returns the x-axis and/or y-axis values.

 CALL:  x    = get_xy_axis(ao.data);
       [x,y] = get_xy_axis(ao.data);
       [x,y] = get_xy_axis(ao.data, pl);
        y    = get_xy_axis(ao.data, pl); --> only possible with a parameter list

 REMARK: In the case with TWO output arguments and only one parameter in 'pl'
         the function returns a empty array for the axis which is not set
         in the parameterlist.

 PARAMETER LIST:  <key>   <value>   <description>
                 'xdata'    't'     returns the values of the x-axis
                 'ydata'    'x'     returns the values of the y-axis

 HISTORY: 25-05-2007 Diepholz
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = get_xy_axis(data, pl)
0002 % GET_XY_AXIS returns the x-axis and/or y-axis values.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: GET_XY_AXIS returns the x-axis and/or y-axis values.
0007 %
0008 % CALL:  x    = get_xy_axis(ao.data);
0009 %       [x,y] = get_xy_axis(ao.data);
0010 %       [x,y] = get_xy_axis(ao.data, pl);
0011 %        y    = get_xy_axis(ao.data, pl); --> only possible with a parameter list
0012 %
0013 % REMARK: In the case with TWO output arguments and only one parameter in 'pl'
0014 %         the function returns a empty array for the axis which is not set
0015 %         in the parameterlist.
0016 %
0017 % PARAMETER LIST:  <key>   <value>   <description>
0018 %                 'xdata'    't'     returns the values of the x-axis
0019 %                 'ydata'    'x'     returns the values of the y-axis
0020 %
0021 % HISTORY: 25-05-2007 Diepholz
0022 %             Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 if nargin < 2
0027   pl = [];
0028 end
0029 
0030 x  = [];
0031 y  = [];
0032 
0033 %% Set default parameter list
0034 if nargout == 1
0035   pl_default = plist(param('xdata',  't'));
0036 else %if nargout == 2
0037   pl_default = plist([param('xdata',  't')
0038                       param('ydata',  'x')]);
0039 end
0040 
0041 
0042 %% Combine the handover param-list and the default param-list
0043 if ~isempty(pl)
0044   pl = combine(pl);
0045 else
0046   pl = combine(pl_default);
0047 end
0048 
0049 do_xdata = find(pl, 'xdata');
0050 do_ydata = find(pl, 'ydata');
0051 
0052 %% Make sure that at least one axis is defined
0053 if isempty(do_xdata) && isempty(do_ydata)
0054   do_xdata = 't';
0055 end
0056 
0057 %% Set x-axis and y-axis values
0058 if ~isempty(do_xdata)
0059   x = data.t;
0060 end
0061 
0062 if ~isempty(do_ydata)
0063   y = data.x;
0064 end
0065 
0066 %% Set outputs
0067 if nargout == 1
0068   if ~isempty(x)
0069     varargout{1} = x;
0070   else % ~isempty(y)
0071     varargout{1} = y;
0072   end
0073 
0074 elseif nargout == 2
0075     varargout{1} = x;
0076     varargout{2} = y;
0077 
0078 else
0079   error('### Incorrect output arguments.');
0080 end
0081 
0082 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003