A GUI application I wrote occasionally remembers old data (text edit entries, plots, etc) between uses even though I haven't designed it to do this. I've noticed that this can cause problems. The entries are there when the program is started or when I edit the gui in guide. Can anyone explain what is happening or how to stop it?

4 件のコメント

Adam
Adam 2018 年 2 月 26 日
Have you accidentally saved a running version of the GUI over the top of the .fig file?
Matthew Brehove
Matthew Brehove 2018 年 2 月 26 日
That sounds like what might be happening. But what does that mean? I don't know how to do that or how to stop it.
Matthew Brehove
Matthew Brehove 2018 年 2 月 26 日
Ok, I guess saving the GUI is just what happens if you hit the 'save' button that guide puts in there by default. I've looked around more and people recommend never pressing that save button. So I removed it. Thanks for pointing me in the right direction. I'll just need to get a .fig file from backup.
Jan
Jan 2018 年 2 月 26 日
This can happen, if you hit the save menu or have a saveas in your code. You can restore the original FIG file from your backup. You do have a backup, don't you? Under Windows try the "Recent Versions". Afterwards you can write protect the FIG file either by fileattrib or in your file browser.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2018 年 2 月 26 日

0 投票

Without seeing the code? This would be pure magic. How could the reader know, what happens? We can only guess. And so do I: You are using global variables to store data. These variables are not cleared between runs of the GUI.
Using globals is a very bad idea and they are known to confuse programmers with unexpected behavior.
But for a real and reliable answer, post the code.

カテゴリ

ヘルプ センター および File Exchange で Environment and Settings についてさらに検索

製品

タグ

質問済み:

2018 年 2 月 26 日

コメント済み:

Jan
2018 年 2 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by