f = figure;
icon_size = 32;
icon = repmat(diag(ones(32,1)),1,1,3);
uicontrol('style','pushbutton','position',[10 10 32 32],'cdata',icon)
savefig(f,'temp.fig')
close(f)
openfig('temp.fig')
