The problem with this function is that it is failing on getting the X position of each bar - so that the errorbar can be placed on the middle of the bar.
The error actually occurs on:
In HG1 this line was getting the X position of the patch. The bar is no longer a patch so you need to get the x position another way.
If you update the if statement to the following:
for i = 1:numbars
if ~verLessThan('matlab', '8.4')
x = handles.bars(i).XData + handles.bars(i).XOffset;
x =get(get(handles.bars(i),'children'), 'xdata');
x = mean(x([1 3],:));
handles.errors(i) = errorbar(x, barvalues(:,i), errors(:,i), 'k', 'linestyle', 'none', 'linewidth', 2);
ymax = max([ymax; barvalues(:,i)+errors(:,i)]);
It works for a "trivial" example. I didn't check for passing in anymore than 2 inputs.