Home > classes > @xydata > get_xy_values.m

get_xy_values

PURPOSE ^

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

SYNOPSIS ^

function varargout = get_xy_values(data, pl)

DESCRIPTION ^

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

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

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

 CALL:         x    = get_xy_values(ao.data);
              [x,y] = get_xy_values(ao.data);
              [x,y] = get_xy_values(ao.data, pl);
               y    = get_xy_values(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'    'x'     returns the values of the x-axis
                 'ydata'    'y'     returns the values of the y-axis

 VERSION:         $Id: get_xy_values.m,v 1.4 2008/02/13 12:57:47 mauro Exp $

 HISTORY:         25-05-2007 Diepholz
                     Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = get_xy_values(data, pl)
0002 % GET_XY_VALUES returns the x-axis and/or y-axis values.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: GET_XY_VALUES returns the x-axis and/or y-axis values.
0007 %
0008 % CALL:         x    = get_xy_values(ao.data);
0009 %              [x,y] = get_xy_values(ao.data);
0010 %              [x,y] = get_xy_values(ao.data, pl);
0011 %               y    = get_xy_values(ao.data, pl); --> only possible with
0012 %                                                      a parameter list
0013 %
0014 % REMARK:       In the case with TWO output arguments and only one parameter in
0015 %               'pl' the function returns a empty array for the axis which is
0016 %               not set in the parameterlist.
0017 %
0018 % PARAMETER LIST:  <key>   <value>   <description>
0019 %                 'xdata'    'x'     returns the values of the x-axis
0020 %                 'ydata'    'y'     returns the values of the y-axis
0021 %
0022 % VERSION:         $Id: get_xy_values.m,v 1.4 2008/02/13 12:57:47 mauro Exp $
0023 %
0024 % HISTORY:         25-05-2007 Diepholz
0025 %                     Creation
0026 %
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 
0029 VERSION  = '$Id: get_xy_values.m,v 1.4 2008/02/13 12:57:47 mauro Exp $';
0030 CATEGORY = 'Internal';
0031 
0032 % Check if this is a call for parameters
0033 if nargin == 2
0034   if isa(data, 'xydata') && ischar(pl)
0035     in = char(pl);
0036     if strcmp(in, 'Params')
0037       varargout{1} = plist;
0038       return
0039     elseif strcmp(in, 'Version')
0040       varargout{1} = VERSION;
0041       return
0042     elseif strcmp(in, 'Category')
0043       varargout{1} = CATEGORY;
0044       return
0045     end
0046   end
0047 end
0048 
0049 if nargin < 2
0050   pl = [];
0051 end
0052 
0053 x  = [];
0054 y  = [];
0055 
0056 %% Set default parameter list
0057 if nargout == 1
0058   pl_default = plist(param('ydata',  'y'));
0059 else %if nargout == 2
0060   pl_default = plist([param('xdata',  'x')
0061                       param('ydata',  'y')]);
0062 end
0063 
0064 
0065 %% Combine the handover param-list and the default param-list
0066 if ~isempty(pl)
0067   pl = combine(pl, pl_default);
0068 else
0069   pl = pl_default;
0070 end
0071 
0072 do_xdata = find(pl, 'xdata');
0073 do_ydata = find(pl, 'ydata');
0074 
0075 %% Make sure that at least one axis is defined
0076 if isempty(do_xdata) && isempty(do_ydata)
0077   do_xdata = 'x';
0078 end
0079 
0080 %% Set x-axis and y-axis values
0081 if ~isempty(do_xdata)
0082   x = data.x;
0083 end
0084 
0085 if ~isempty(do_ydata)
0086   y = data.y;
0087 end
0088 
0089 %% Set outputs
0090 if nargout == 1
0091   if ~isempty(y)
0092     varargout{1} = y;
0093   else % ~isempty(y)
0094     varargout{1} = x;
0095   end
0096 
0097 elseif nargout == 2
0098     varargout{1} = x;
0099     varargout{2} = y;
0100 
0101 else
0102   error('### Incorrect output arguments.');
0103 end
0104 
0105 % END

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003