y = grpstats(x,grps,'sum');
ytxt = round(y./repmat(nansum(y,2),1,size(y,2))*100);
ytxt = num2cell(ytxt);
ytxt = cellfun(@(x) [sprintf('%0.1f',x), '%'], ytxt,'un',0);
figure('Position',[107 516 813 182]);
hB = bar(y,'group','EdgeColor','w','BarWidth',1);
hT=[];
for i=1:length(hB)
hT=[hT,text(hB(i).XData+hB(i).XOffset,hB(i).YData, ytxt(:,i), ...
'VerticalAlignment','bottom','horizontalalign','center')];
end
grid on