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

10 次查看(过去 30 天)
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Source Control Integration 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by