function myButtonRandColor()
%% function generating GUI and defines callback function
hFig = uifigure('Position',[500 500 500 50], ...
'Resize', false);
hLabel = uilabel(hFig, 'Text', 'yellow', ...
'Position', [0 0 250, 50], ...
'HorizontalAlignment', 'center');
hButt = uibutton(hFig, 'Text', 'my button', ...
'Position', [250 10 250 30], ...
'BackgroundColor', 'y');
hButt.ButtonPushedFcn = @(src, event)changeColor(hButt, hLabel);
end
function changeColor(hButt, hLabel)
Color = rand(1,3);
hButt.BackgroundColor = Color;
hLabel.Text = sprintf('[R:%0.4f, G:%0.4f,B:%0.4f]', Color);
end