GUI briefly loading "old" data into graphs upon program initialization

3 vues (au cours des 30 derniers jours)
Hi. I have a program that runs through a GUI. When the program loads there is a brief period when it appears to be loading "old" data into figures/graphs. This old data at one point in time had been fed into the program during development. This data was pulled from an external file and then graphed, so I am not sure how it still "remembers" it as the file is no longer in the same directory as the current GUI files. I have the same issue with an old logo that was read from a png file - when the program loads for a second or so the old logo still shows up before all the graphs/figures clear and the current logo loads. Any ideas how to remove this issue? Not sure if pictures will really help, but can provide if needed. thanks! h

Réponse acceptée

Walter Roberson
Walter Roberson le 18 Mar 2018
The data was in the figure at the time you saved the .fig file, so it will be replotted as the GUI is reinitialized.
You should go back into GUIDE and edit the properties of those axes and save the fig.
  11 commentaires
Walter Roberson
Walter Roberson le 19 Mar 2018
fig = GUI;
handles = guidata(fig);
cla(handles.axis_1);
cla(handles.logo_axis);
HpW
HpW le 19 Mar 2018
so I ended up just deleting and re-inserting the axes again and now they work without the old data showing up on initialization. Not sure why wasn't working before but seems to be working now. thanks again for all of your help!

Connectez-vous pour commenter.

Plus de réponses (1)

Nicolás Aristimuño Padrón
Hey, I'm glad that you could solve the problem. Yesterday it happened the same to me and I saw this post and could solve it too. However, in my gui, I had the "Save" button, as well as the "Zoom" and the "hand". I accidentaly clicked on the Save button of the GUI instead of the Save button in the .fig file that contains the GUI design. Then, everything changed and started to load old data, the same data that was on the GUI when I clicked on that Save Button. Then, in order to solve it I had to reset the axes from the .m file and then click again on that Save button. This is because as the .fig file did change, then I could not solve it from there. The error source was on the GUI that calls the GUI.m file, so that should be solved from there, instead than from the .fig file. Its tricky...
Also, if you have any plot in your axes, then when reset and saving again, these axes will change their tag, so you have to put the tags again from the .fig file. Then is fine!
Hope this non-obvious error and solution can help other people. And remember to NOT include the Save button into the GUI haha

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by