Saving & Loading GUI Data Entry & Results
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I have made a program with 13 GUIDE GUIs or so interlinked by the same drop down menu system.
Each has both data entry boxes and results displayed in static text boxes, graphs and tables when calculation buttons are pushed. It's a very complex program, but that is the basis of it.
Each GUI has it's data entry and calculation results stored in handles. Each GUI passes some of it's information to others, using a global structure. Sometimes the global structure variable is loaded and stored in the handle for the GUI it's being passed to, other times it's just fetched from the global structure and used directly.
I have a welcome screen that I want to add options to to save or load an analysis - data entry and results. I want to be able to close the program, and load a file to get back to where I was.
I have played with the save function, but this only allows me to save all of the handles for the current GUI - it does however when opened return the GUI to how it was, data entry, results and all - what I want.
I want to avoid having to press save on all 13 GUIs though if I can... I can see though that this could work, saving each GUIs handle as a .mat file, and loading all (somehow, but do-able) in the welcome screen menu, when an item was chosen in a dropdown menu.
Ideally I would click a save button on the welcome screen and save everything (all GUI handles and the global structure) naming the .mat file depending on what the user wanted, and load that up at a later date if required using a dropdown menu.
I have no idea how to achieve this, let alone how to do it efficiently.
Any help would be much appreciated.
Thanks in advance,
Matt
2 comentarios
Adam
el 1 de Sept. de 2016
I tend to use classes for this kind of thing. You really don't want to have to be storing full handles structures to file if you don't need to.
Even if you are storing data on handles it would be best to store all the data from one UI in a single structure on the handles of that GUI, then you just need to save this one structure to file and, when you load it back in, update the GUI components from it.
Again, I would generally do this by having a class that controls the main functionality and knows about all the parameter objects from other parts of the program. Then I can just save this one object and everything else comes with it. In practice I usually need to save a few objects, but the general idea is to detach your data from the UI rather than trying to drag all the UI handles along with it.
I imagine it is far too late in your process to start using OOP (Object-oriented programming) to solve this problem, but if you can try to arrange your parameters in as few structures as possible it would at least be a start.
Respuestas (1)
Adam
el 1 de Sept. de 2016
doc savefig
looks like the programmatic equivalent of saving a figure manually so if your GUIs are capable of communicating with each other then you would only need to click a 'Save' button in one place and it could programmatically save all your figures.
I don't know exactly what it saves and whether all your data will be exactly as needed when you load it again, but you can try it.
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!