function btnup(figHandle, groupId, buttonId)
%BTNUP	Raise a button in a toolbar button group.
%	BTNUP(FIGHANDLE, GROUPID, BUTTONID) raises the button
%	specified by the string BUTTONID in the button group
%	specified by the string GROUPID in figure FIGHANDLE.  
%
%	BTNUP(FIGHANDLE, GROUPID, BUTTONNUM) raises the button
%	numbered BUTTONNUM.  Buttons are numbered down the
%	columns of the button group.
%
%	See also: btngroup, btnstate, btnpress, btndown.

%	Steven L. Eddins, 29 June 1994
%	Copyright (c) 1984-94 by The MathWorks, Inc.
%	$Revision: 1.9 $  $Date: 1995/01/29 05:43:30 $


axesHandle = findobj(get(figHandle, 'children'), 'flat', ...
    'Tag', groupId);
axesHandle = axesHandle(1);

if (isstr(buttonId))
  % Determine the button number.
  buttons = get(get(axesHandle, 'XLabel'), 'UserData');
  for k = 1:size(buttons,1)
    temp = buttons(k,:);
    temp(temp==' ') = []; % deblank
    if (strcmp(temp, buttonId))
      buttonNumber = k;
      break;
    end
  end
else
  buttonNumber = buttonId;
  % Determine the button ID.
  buttons = get(get(axesHandle, 'XLabel'), 'UserData');
  buttonId = buttons(buttonNumber,:);buttonId(buttonId == ' ') = []; % Deblank
end

colorSet = getuprop(axesHandle, 'Colors');
buttonColor = colorSet(1,:);
buttonColorDark = colorSet(2,:);
bevelLight = colorSet(3,:);
bevelDark = colorSet(4,:);

buttonObjects = findobj(axesHandle, 'Tag', buttonId);
ulLine = findobj(buttonObjects, 'flat', 'UserData', 'ULBorder');
lrLine = findobj(buttonObjects, 'flat', 'UserData', 'LRBorder');
downBorder = findobj(buttonObjects, 'flat', 'UserData', 'DownBorder');

set(ulLine, 'FaceColor', bevelLight);
set(lrLine, 'FaceColor', bevelDark);
set(downBorder, 'FaceColor', buttonColor);

stateVector = get(axesHandle, 'UserData');
stateVector(buttonNumber) = 0;
set(axesHandle, 'UserData', stateVector);
