How to restrict a background from changing?

2 visualizaciones (últimos 30 días)
Brennan Schilling
Brennan Schilling el 23 de Ag. de 2017
Respondida: Adam el 23 de Ag. de 2017
I have two guis, one with buttons and one with a plot. When the plot appears the gui with the buttons' background becomes an empty plot. How do I make sure this doesn't happen?
NOTE: I do not like this answer, I want something simpler and easier to understand: https://www.mathworks.com/matlabcentral/answers/262776-matlab-gui-showing-axis-at-the-background

Respuestas (1)

Adam
Adam el 23 de Ag. de 2017
Plot functions and hold and all other similar functions take an axes handle as their first argument. Use it! So many people seem to just call plot or hold and hope for the best as to where it will actually get applied to. If you keep hold of your axes handle and just pass it to the hold instruction or whatever else you are calling (you haven't shown any code so I'm just guessing) then this won't happen.
If you call a function that expects to work on an axes and the current figure has no axes it will simply create one, however inappropriate this may seem to you, even if it is just doing so in order to set the 'hold' status to on.
All this can be avoided by common sense programming of explicitly telling your code which axes to act upon.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by