You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bar_centers.m
    path of file: ./repos/CanlabCore/CanlabCore/Visualization_functions/Support
    
    the code of the file until where you have to start completion: % function centers = bar_centers(handles)
%
% BAR_CENTERS determines the actual X centers of grouped bars for further plotting purposes
%   Inputs:
%       handles - a handle or handles to start searching from. Ideally, this should be the barseries handle(s), but axes handles will usually work, too
%   Outputs:
%       centers - a list of centers, one row per grou
    
function centers = bar_centers(handles)
%
% BAR_CENTERS determines the actual X centers of grouped bars for further plotting purposes
%   Inputs:
%       handles - a handle or handles to start searching from. Ideally, this should be the barseries handle(s), but axes handles will usually work, too
%   Outputs:
%       centers - a list of centers, one row per group
%
% Note: Updated for Matlab 2020b, which uses XEndPoints

function centers = bar_centers(handles)

%     hPatches = findobj(handles, 'Type', 'patch'); % old Matlab, pre-2015
    
%     if isempty(hPatches)
%        % new matlab?
        hPatches = findobj(handles, 'Type', 'bar');
%     end