Just for information, I produced the second figure with the desired layout of my text with this code
figure('color',[1 1 1])
annotation('textbox',[0.7 0 0 0.5],'String',{[groups{1},', ',groups{2}]},'FitBoxToText','on');
but obviously, it does not fullfil condition (1), i.e. to use a single index "i".