Home > classes > @xyzdata > get_xyz_values.m

get_xyz_values

PURPOSE ^

GET_XYZ_VALUES returns the x-axis and/or y-axis and/or z-axis values.

SYNOPSIS ^

function varargout = get_xy_values(data, pl)

DESCRIPTION ^

 GET_XYZ_VALUES returns the x-axis and/or y-axis and/or z-axis values.

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

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

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

 REMARK:       In the case with 3 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
                 'zdata'    'z'     returns the values of the z-axis

 VERSION:         $Id: get_xyz_values.m,v 1.1 2007/12/24 19:47:06 hewitson Exp $

 HISTORY:         24-12-2007 Hewitson
                     Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = get_xy_values(data, pl)
0002 % GET_XYZ_VALUES returns the x-axis and/or y-axis and/or z-axis values.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: GET_XYZ_VALUES  returns the x-axis and/or y-axis and/or z-axis
0007 %                              values.
0008 %
0009 % CALL:         x    = get_xyz_values(ao.data);
0010 %              [x,y] = get_xyz_values(ao.data);
0011 %            [x,y,z] = get_xyz_values(ao.data);
0012 %              [x,y] = get_xyz_values(ao.data, pl);
0013 %            [x,y,z] = get_xyz_values(ao.data, pl);
0014 %               z    = get_xyz_values(ao.data, pl); --> only possible with
0015 %                                                      a parameter list
0016 %
0017 % REMARK:       In the case with 3 output arguments and only one parameter in
0018 %               'pl' the function returns a empty array for the axis which is
0019 %               not set in the parameterlist.
0020 %
0021 % PARAMETER LIST:  <key>   <value>   <description>
0022 %                 'xdata'    'x'     returns the values of the x-axis
0023 %                 'ydata'    'y'     returns the values of the y-axis
0024 %                 'zdata'    'z'     returns the values of the z-axis
0025 %
0026 % VERSION:         $Id: get_xyz_values.m,v 1.1 2007/12/24 19:47:06 hewitson Exp $
0027 %
0028 % HISTORY:         24-12-2007 Hewitson
0029 %                     Creation
0030 %
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 
0033 VERSION  = '$Id: get_xyz_values.m,v 1.1 2007/12/24 19:47:06 hewitson Exp $';
0034 
0035 % Check if this is a call for parameters
0036 if nargin == 2
0037   if ischar(pl)
0038     in = char(pl);
0039     if strcmp(in, 'Params')
0040       varargout{1} = plist;
0041       return
0042     elseif strcmp(in, 'Version')
0043       varargout{1} = VERSION;
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('xdata',  'x'));
0059 elseif nargout == 2
0060   pl_default = plist([param('xdata',  'x')
0061                       param('ydata',  'y')]);
0062 elseif nargout == 3
0063   pl_default = plist('xdata', 'x', 'ydata', 'y', 'zdata', 'z');
0064 else
0065   error('### Incorrect outputs.');
0066 end
0067 
0068 
0069 %% Combine the handover param-list and the default param-list
0070 if ~isempty(pl)
0071   pl = combine(pl);
0072 else
0073   pl = combine(pl_default);
0074 end
0075 
0076 do_xdata = find(pl, 'xdata');
0077 do_ydata = find(pl, 'ydata');
0078 do_zdata = find(pl, 'zdata');
0079 
0080 %% Make sure that at least one axis is defined
0081 if isempty(do_xdata) && isempty(do_ydata)
0082   do_xdata = 'x';
0083 end
0084 
0085 %% Set x-axis and y-axis values
0086 if ~isempty(do_xdata)
0087   x = data.x;
0088 end
0089 
0090 if ~isempty(do_ydata)
0091   y = data.y;
0092 end
0093 
0094 if ~isempty(do_zdata)
0095   z = data.z;
0096 end
0097 
0098 %% Set outputs
0099 if nargout == 1
0100   if ~isempty(x)
0101     varargout{1} = x;
0102   else % ~isempty(y)
0103     varargout{1} = y;
0104   end
0105 
0106 elseif nargout == 2
0107     varargout{1} = x;
0108     varargout{2} = y;
0109 
0110 elseif nargout == 3
0111     varargout{1} = x;
0112     varargout{2} = y;
0113     varargout{3} = z;
0114 else
0115   error('### Incorrect output arguments.');
0116 end
0117 
0118 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003