Opposite of drawnow - prevent changes to a listbox
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (1)
Bill York
il 10 Feb 2017
0 voti
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 Commenti
Walter Roberson
il 10 Feb 2017
I think they want to update the menu without having it make a visible difference, such as if their code fetches values from the graphics objects.
Matthew Murphy
il 10 Feb 2017
Walter Roberson
il 11 Feb 2017
I have used similar approaches at times, Matthew.
However, my experience over time has been that this approach is triggered by holding control and data parameters in the wrong place. It is needed when the "primary" information is being held in graphics objects, when what is better is to use the graphics callbacks to access information held elsewhere. If the graphics objects are not considered to be authoritative about what the information "really" is, then you can control the program by changing what is "really" there without changing the graphics.
I also find that when these schemes become attractive, that I have usually hard-coded access to the primary data when really I should be creating a parameter set and telling the code to work on the parameter set. Instead of the code continually accessing an equivalent-to-global "master" copy of the data, the flow of control should be able to conjure up what could be called a "hypothesis variant" and the routines would work on that. (I say "equivalent-to-global" because although guidata() against your main figure might not technically use the keyword "global", in practice it is used very much the same way.) Unfortunately the way that callback routines are invoked in the base workspace makes a bit tricky to designate which hypothesis variant you are processing at any one time.... it isn't like in more linear programming where you can just create a control structure and each level of call passes it down as needed.
Anyhow... if you are manipulating graphics object properties because routines expect to read the properties out of the graphics objects in order to determine flow of control or flow of data, then you have put the information in the wrong place.
In smaller programs, I end up holding information in graphics objects a lot. It is easy to do. It works okay for less complex programs. It just doesn't turn out to be sustainable for larger programs.
Matthew Murphy
il 13 Feb 2017
Walter Roberson
il 13 Feb 2017
guidata() is not quite global data, but we tend to treat it like it is and we tend to get annoyed when it does not act like global data.
guidata() is attached to the figure that is the ancestor of the object passed as the first parameter to guidata(). That allows there to be multiple such structures that you can distinguish. But if you do have more than one figure then chances are that you want to be able to access data between them and then the separation gets annoying...
If you are using multiple figures then you might well also be finding objects by tag, and then you have the problem that tag names are not qualified by figure. You have to know to pass an appropriate parent object in to findobj().
It is not clear to me what a better way would be to keep data separate but allow convenient sharing across data pools.
Matthew Murphy
il 13 Feb 2017
Walter Roberson
il 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
il 14 Feb 2017
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!