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

7 views (last 30 days)
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

Accepted Answer

Stephen23
Stephen23 on 14 Jun 2017

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!