MATLAB GUI loading unwanted data

I created a GUI using GUIDE, and at some point I must've saved settings or something. The GUI has a plot window that should be blank when the GUI loads, but it has data in it on load. However, when I check in the Properties, there's no UserData. This isn't the only element to reset to some unknown state, elements that shouldn't be populated are when first loaded. It seems like some sort of settings are being loaded on initialization, but I can't find where. Can anybody help with this?

Réponses (1)

Image Analyst
Image Analyst le 27 Oct 2013

0 votes

An axes will have properties that you can pre-set in GUIDE, but it will have no data unless you put it in. In your openingFcn, you must be assigning something to the GUI, perhaps after you call a load(), or maybe you just hard coded something in. Step though the function one line at a time until you find the statement that does it. http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/

4 commentaires

Adam
Adam le 27 Oct 2013
Modifié(e) : Adam le 27 Oct 2013
I didn't hard code anything, and I don't call load. The axis in question has a child, which has data. I'm not sure where this child is coming from, and I'm not seeing it being created when I step through it in debug. I can "fix" it by clearing the children in OpeningFcn, but that's such a hack. Any other advice?
Adam
Adam le 27 Oct 2013
One more comment, I'm pretty sure data was somehow saved in the .fig file. I've loaded that as a mat file to try to find it, any idea where to look?
Image Analyst
Image Analyst le 27 Oct 2013
Huh? You don't load a .fig file as you would a .mat file. A mat file is a binary file (propeitary format) with a bunch of variables in it. A .fig file is a file created by GUIDE that tells MATLAB how to build a GUI. You shouldn't load a .fig file as a .mat file. Why don't you attach your m-file, fig-file, and any mat or data files using the paperclip icon so people can try them?
Adam
Adam le 28 Oct 2013
I used hgload and hgsave, is that not what they are used for? Either way, I got it fixed, thanks for the help.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Tags

Question posée :

le 27 Oct 2013

Commenté :

le 28 Oct 2013

Community Treasure Hunt

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

Start Hunting!

Translated by