tags:

views:

283

answers:

1

I created a gui with MATLAB's GUI Builder. After some changing around, an image of an old plot is still loaded into the gui on start up. How can I tell MATLAB to disregard that old plot?

I added a toolbar by adding

set(hObject,'toolbar','figure');

into the "gui_OpeningFcn". Now I decided that I don't want the toolbar in my gui any longer. But when I remove this line, the toolbar is still created. How do I tell MATLAB not to load the old stuff anymore? And where do those settings get stored anyway?

EDIT: I investigated a little bit, and this behaviour can be reproduced as follows:

  • create a new gui with the GUI builder and add plot
  • add the line "set(hObject,'toolbar','figure');" into the "*_OpeningFcn"
  • add a simple function into the plot (adding something like "plot(handles.axes1,[1:10], [1:10])" into the "*_OpeningFcn" will do)
  • run the gui and save the figure by clicking the save button in the toolbar
  • now when I remove "set(hObject,'toolbar','figure');" and "plot(handles.axes1,[1:10], [1:10])" from "*_OpeningFcn" and run the gui, the toolbar and the plot will still be displayed

I am sure this behaviour is intentional. But where are those settings stored, so I can reverse them?

+1  A: 

I found out how to turn off the toolbar.

  • Select in the GUI builder view->Property Inspector
  • In the ToolBar field select "none"

Edit: I also found a way that the old plot is not loaded into the gui.

  • I created an empty "createFcn" for the plot.
  • and ran the gui once afterwards
  • then I deleted the createFcn again

But I very much doubt that this would be the standard way to achieve that. So please don't hesitate to give a better solution.

Lucas