function setDisplayUnits(this,WhichCoord,Value)
% Set units for a particular coordinate axis

%   Author: A. Stothert
%   Copyright 1986-2004 The MathWorks, Inc. 
%   $Revision: 1.1.6.1 $ $Date: 2004/12/10 19:31:09 $

errmsg = '';
%Check which coordinates units we are setting
switch lower(WhichCoord)
   case 'xunits'
      Units = 'xDisplayUnits';
   case 'yunits'
      Units = 'yDisplayUnits';
   otherwise
      errmsg = sprintf('Can not identify ''%s'' display unit to update',WhichCoord);
end
if ~ischar(Value)
   errmsg = sprintf('The new units value must be a string argument.');
end

if isempty(errmsg)
   %No errors, set the new units value
   this.(Units) = Value;
else
   error(errmsg);
end