function location = genLocation(h)
% Author: Isaac Noh
% Copyright 2008-2009 The MathWorks, Inc.
% Version: 1.1
for i = 1:length(h)
xloc = get(h(i),'XData');
yloc = get(h(i),'YData');
if abs(diff(yloc)) > abs(diff(xloc))
row = char(64+[round(10*(1.1-yloc(2))):round(10*(1-yloc(1)))]);
col = num2str(round(10*(xloc(2))));
if i ==1
location = cellstr([row', repmat(col,length(row),1)]);
else
location = [location; cellstr([row', repmat(col,length(row),1)])];
end
else
row = char(64+round(10*(1-yloc(1))));
col = num2str(round([10*(xloc(1)+0.1):10*(xloc(2))]'));
if i ==1
location = cellstr([repmat(row,length(col),1), col]);
else
location = [location; cellstr([repmat(row,length(col),1), col])];
end
end
end
location = regexprep(location,'\s','');