function Value = pvget(RespObj,Property)
%PVGET  Get values of public Response Object properties.
%
%   VALUES = PVGET(RespObj) returns the values of all public 
%   properties of RespObj in the cell array VALUES.
%
%   VALUES = PVGET(RespObj,PROPERTY) returns the value of the
%   single property with name PROPERTY.  The string property
%   must contain the true property name.
%   
%   See also GET.

%   Author(s): P. Gahinet, 7-8-97
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.7 $ $Date: 2000/06/14 20:11:11 $

ni = nargin;

% Get all ICPLOT-specific public properties and their values
ICPropNames = pnames(RespObj,'specific');
ICPropValues = struct2cell(RespObj);

% Get property value(s)
if ni==1
   % Get all property values
   Value = [ICPropValues(1:length(ICPropNames)) ; ...
         pvget(RespObj.response)];
else
   % Value of single property
   % Look among ICPLOT-specific properties
   imatch = find(strcmp(Property,ICPropNames));
   
   if isempty(imatch),
      % Look among parent properties
      Value = pvget(RespObj.response,Property);
      
   elseif strcmp(Property,'PeakResponseValue')
      % Special ICPLOT-specific property
      Value = RespObj.PeakResponseValue;
      if any(cellfun('isempty',{Value.System}))
         % Compute Peak Response
         [Value,RespObj] = calcopt('PeakResponseValue',RespObj);
         ContextMenu = pvget(RespObj.response,'UIContextMenu');
         builtin('set',ContextMenu.Main,'UserData',RespObj)
      end
      
   else
      % Other ICPLOT-specific property
      Value = ICPropValues{imatch};
   end
end

