MATLAB Answers

Opposite of drawnow - prevent changes to a listbox

17 views (last 30 days)
I am using GUIDE to create plots of experimental data. In my figure, I have menus in which I store the input data categories and output categories of functions that I run on that data.
As I operate on those plots, the need arises to change the contents of those menus, operate on the data, then change the menus back to a presentable format.
In essence, I am trying to prevent those menus from being visibly updated, while still changing the contents so I can use them to do what I need to do. Since drawnow forces a graphical update, I was wondering if there was an opposite equivalent of that call.
Any comments and suggestions are welcome.

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Feb 2017
About the only equivalent is to set the visibility of the items to be off. The items disappear from view, but any internal changes do not result in visible changes until the visibility is set back on again.

  5 Comments

Show 2 older comments
Matthew Murphy
Matthew Murphy on 13 Feb 2017
My most troublesome updates come when I am updating the contents of my menus.
I don't know if the version is relevant, but I am stuck with 2010b.
Whenever I do menu updates, I have to do a "set" call:
set(handles.exampleMenu,'String',contentCell);
Those set() calls are forcing the graphical update that I was having problems with (see my comment on your other comment below - I have changed the program, but this answer piqued my interest).
So in essence, I rarely have any drawnow() calls because these set() calls and plot() calls already force updates. I guess those would be the most useful to suppress, but I'm not sure if it's possible.
Walter Roberson
Walter Roberson on 13 Feb 2017
Even in R2010b, using set() should never trigger immediate graphics updates except perhaps setting figures visible -- with the exception that if you are at the command line (especially the debugger) then the graphics is updated before the prompt is given.
Matthew Murphy
Matthew Murphy on 13 Feb 2017
Ah. Did not know that.
Also accepted your answer due to the help and advice you have given with regards to this question.

Sign in to comment.

More Answers (1)

Bill York
Bill York on 10 Feb 2017
It sounds like you want to update the graphics without updating the menus. There is no way in MATLAB to do this.
Could you tell me more about how you are using the menus? There may be another way to achieve your goal that does not collide with updating the graphics.

  8 Comments

Show 5 older comments
Matthew Murphy
Matthew Murphy on 13 Feb 2017
Yeah, in total I have 11 figures (most are relatively simple, about 3 are fairly complex). they are all controlled through one main figure, so I pass data to them using the handles/guidata structure.
So in my case, the data is fine being conglomerated into one large mass. I do all of my division through aptly named structures.
Using GUIDE helps tremendously with that, as I can preallocate axes and menus tags in order for population later.
Walter Roberson
Walter Roberson on 14 Feb 2017
GUIDE uses guidata() relative to the object whose callback is being invoked, which refers back to the figure enclosing that object. That has some advantages, but if you are working in the mode of having a "main" GUI figure and other figures that are under the control of the main figure, then it is more common than not to want the controls in the secondary figures to be able to refer to data in the main figure.
I do not know if there are good solutions to the complex interactions. Perhaps if you could somehow designate a particular data pool to be used by the figure and if the data pool could be shared between multiple figures.
Matthew Murphy
Matthew Murphy on 14 Feb 2017
I just use the handles structure for that.
GUIDE automatically generates it to store all tags for the figure objects when it initializes the GUI and maintains it as long as the figure's open. For my main figure, I initialize data storage fields in the opening function. For "sub"-figures, I pass through the main figure's handles structure as an argument to its opening function and access the data that way.
That way I can call guidata() on my handles structure as it is tied directly to each figure.

Sign in to comment.

Sign in to answer this question.


Translated by