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.2 2008/02/13 13:22:45 mauro 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.2 2008/02/13 13:22:45 mauro Exp $
0027 %
0028 % HISTORY:         24-12-2007 Hewitson
0029 %                     Creation
0030 %
0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0032 
0033 VERSION  = '$Id: get_xyz_values.m,v 1.2 2008/02/13 13:22:45 mauro Exp $';
0034 CATEGORY = 'Internal';
0035 
0036 % Check if this is a call for parameters
0037 if nargin == 2
0038   if ischar(pl)
0039     in = char(pl);
0040     if strcmp(in, 'Params')
0041       varargout{1} = plist();
0042       return
0043     elseif strcmp(in, 'Version')
0044       varargout{1} = VERSION;
0045       return
0046     elseif strcmp(in, 'Category')
0047       varargout{1} = CATEGORY;
0048       return
0049     end
0050   end
0051 end
0052 
0053 if nargin < 2
0054   pl = [];
0055 end
0056 
0057 x  = [];
0058 y  = [];
0059 
0060 %% Set default parameter list
0061 if nargout == 1
0062   pl_default = plist(param('xdata',  'x'));
0063 elseif nargout == 2
0064   pl_default = plist([param('xdata',  'x')
0065                       param('ydata',  'y')]);
0066 elseif nargout == 3
0067   pl_default = plist('xdata', 'x', 'ydata', 'y', 'zdata', 'z');
0068 else
0069   error('### Incorrect outputs.');
0070 end
0071 
0072 
0073 %% Combine the handover param-list and the default param-list
0074 if ~isempty(pl)
0075   pl = combine(pl);
0076 else
0077   pl = combine(pl_default);
0078 end
0079 
0080 do_xdata = find(pl, 'xdata');
0081 do_ydata = find(pl, 'ydata');
0082 do_zdata = find(pl, 'zdata');
0083 
0084 %% Make sure that at least one axis is defined
0085 if isempty(do_xdata) && isempty(do_ydata)
0086   do_xdata = 'x';
0087 end
0088 
0089 %% Set x-axis and y-axis values
0090 if ~isempty(do_xdata)
0091   x = data.x;
0092 end
0093 
0094 if ~isempty(do_ydata)
0095   y = data.y;
0096 end
0097 
0098 if ~isempty(do_zdata)
0099   z = data.z;
0100 end
0101 
0102 %% Set outputs
0103 if nargout == 1
0104   if ~isempty(x)
0105     varargout{1} = x;
0106   else % ~isempty(y)
0107     varargout{1} = y;
0108   end
0109 
0110 elseif nargout == 2
0111     varargout{1} = x;
0112     varargout{2} = y;
0113 
0114 elseif nargout == 3
0115     varargout{1} = x;
0116     varargout{2} = y;
0117     varargout{3} = z;
0118 else
0119   error('### Incorrect output arguments.');
0120 end
0121 
0122 % END

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