


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.2 2007/11/28 13:03:32 ingo Exp $
HISTORY: 25-05-2007 Diepholz
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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.2 2007/11/28 13:03:32 ingo Exp $ 0023 % 0024 % HISTORY: 25-05-2007 Diepholz 0025 % Creation 0026 % 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 0029 VERSION = '$Id: get_xy_values.m,v 1.2 2007/11/28 13:03:32 ingo Exp $'; 0030 0031 % Check if this is a call for parameters 0032 if nargin == 2 0033 if isa(data, 'xydata') && ischar(pl) 0034 in = char(pl); 0035 if strcmp(in, 'Params') 0036 varargout{1} = plist; 0037 return 0038 elseif strcmp(in, 'Version') 0039 varargout{1} = VERSION; 0040 return 0041 end 0042 end 0043 end 0044 0045 if nargin < 2 0046 pl = []; 0047 end 0048 0049 x = []; 0050 y = []; 0051 0052 %% Set default parameter list 0053 if nargout == 1 0054 pl_default = plist(param('xdata', 'x')); 0055 else %if nargout == 2 0056 pl_default = plist([param('xdata', 'x') 0057 param('ydata', 'y')]); 0058 end 0059 0060 0061 %% Combine the handover param-list and the default param-list 0062 if ~isempty(pl) 0063 pl = combine(pl); 0064 else 0065 pl = combine(pl_default); 0066 end 0067 0068 do_xdata = find(pl, 'xdata'); 0069 do_ydata = find(pl, 'ydata'); 0070 0071 %% Make sure that at least one axis is defined 0072 if isempty(do_xdata) && isempty(do_ydata) 0073 do_xdata = 'x'; 0074 end 0075 0076 %% Set x-axis and y-axis values 0077 if ~isempty(do_xdata) 0078 x = data.x; 0079 end 0080 0081 if ~isempty(do_ydata) 0082 y = data.y; 0083 end 0084 0085 %% Set outputs 0086 if nargout == 1 0087 if ~isempty(x) 0088 varargout{1} = x; 0089 else % ~isempty(y) 0090 varargout{1} = y; 0091 end 0092 0093 elseif nargout == 2 0094 varargout{1} = x; 0095 varargout{2} = y; 0096 0097 else 0098 error('### Incorrect output arguments.'); 0099 end 0100 0101 % END