MATLAB: How to change the width of horizontal lines of error bars in ERRORBAR plot in MATLAB 2015b

2015berrorbar

I am working with MATLAB 2015b and when using the ERRORBAR function, I would like to be able to change the length of the horizontal lines appearing on top and bottom of the error bars.
This question has been answered for the 2014 version of MATLAB but the solution doesn't work for the newer version of MATLAB.
Thanks in advance for your help.
Example:
x = [1 2 3 4];
y = [1 2 1 2];
dy = [0.1 0.1 0.1 0.1];
errorbar(x,y,dy)

Best Answer

The solution is hidden in the comments of Arnaud's errorbar_tick.m.
Edit the original errorbar_tick.m, find the if-else-structure below "% Plot error bars" and replace it with the code Matt posted in the comments:
if strcmpi(flagtype,'errorbar') % ERRORBAR(...)
x = h.Bar.VertexData(1,:); % Retrieve bar xdata from errorbar
dp = length(x)/3; % 3 data points per error bar
m = 1; % Multiplier for addition/subtraction
for ii = 1:dp
m = -1*m; % Switch between subtraction and addition
x(dp+ii:dp:end) = x(ii)+m*w/2; % Change xdata with respect to the chosen ratio
end
h.Bar.VertexData(1,1:end) = x;
else
error('Please enter an ErrorBar object!');
end
Works fine for me on 2015b!