function gui_with_pushbutton

f = figure('Visible', 'off', 'color', 'white', 'Position',...
   [360, 500, 800, 600]);

set(f, 'Name', 'GUI with editable text')

movegui(f, 'center')

hsttext = uicontrol('Style', 'text', ...
   'BackgroundColor', 'white', ...
   'Position', [100, 425, 400, 55], ...
   'String', 'Enter your string here');

huitext = uicontrol('Style', 'edit', 'Position', [100, 400, 400, 40]);

hbutton = uicontrol('Style', 'pushbutton', 'String', ...
   'Push me!!', 'Position', [600, 50, 150, 50], ...
   'Callback', @callbackfn);

set(f, 'Visible', 'on');

   function callbackfn(source, eventdata)
      set([hsttext huitext hbutton], 'Visible', 'off');
      printstr = get(huitext, 'String');
      hstr = uicontrol('Style', 'text', ...
         'BackgroundColor', 'white', ...
         'Position', [100, 400, 400, 55], ...
         'String', printstr, ...
         'ForegroundColor', 'Red', 'Fontsize', 30);
      set(hstr, 'Visible', 'on')
      fprintf('%s\n',get(source, 'String'));
   end
end

