how to create structure that persists over multiple runs of the same code

7 ビュー (過去 30 日間)
Mike Wilson
Mike Wilson 2017 年 6 月 13 日
コメント済み: Mike Wilson 2017 年 6 月 14 日
I'm looking for a clean way store a structure of variables that persist over multiple runs of the same code.
I use GUIDE to create UIs for processing and plotting geophysical data from full planet scale down to local study areas. Data is both satellite swaths and model output (full coverage). Users often do multiple runs / re-plots in one session. They select a bunch of options in the UI and press a "Run" button to start that process. After inspecting the first plot, most frequently they make a few UI changes and run again, and again, and ...
For each of those re-runs, only a small portion of the many control variables are changed. Those get changed and properly stored by the UI callbacks as the user clicks to make the changes. Unless I do something which seems like poor programming, all the other control parameters from the previous run are lost and have to be retrieved.
The (poor programming) solution I've found is to store those control parameters in the "handles" structure where all the UI components are located. That works fine as that structure persists between runs. But it seems messy to store operation specific control variables in the same place where all the UI elements are located.
I could write all those control variables to a file that gets updated with each run and read that file back in every time the Run button is pushed. Also could re-query all the UI elements every time the Run button is pushed. Both approaches seem really inefficient and error prone.
Is there some simple way to have a structure persist between multiple executions of a Run command in the same manner that the UI Handles structure does?
Thanks!
Mike

採用された回答

Stephen23
Stephen23 2017 年 6 月 14 日
  1 件のコメント
Mike Wilson
Mike Wilson 2017 年 6 月 14 日
Perfect! Just what i was looking for - persistent but not global. Thanks very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by