Saving & Loading GUI Data Entry & Results

3 visualizzazioni (ultimi 30 giorni)
Matt
Matt il 1 Set 2016
Modificato: Matt il 15 Feb 2017
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 Commenti
Adam
Adam il 1 Set 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.
Matt
Matt il 1 Set 2016
Modificato: Matt il 1 Set 2016
Thanks - I think it is too late unfortunately.
It's so frustrating learning things like this as you go, as I know so much more now that I can improve my program a lot, however it is for use at work, and as such I need it to be usable soon, and carrying out analysis accurately, which it currently is, so i'm reluctant to make major changes, as i've tested a lot of it well.
I wonder how I can solve this!
I need to be able to save the input and results so that in a years time I could open it and see my analysis. Currently done in Excel with many macros, and you don't bat an eyelid about saving... this on the other hand!

Accedi per commentare.

Risposte (1)

Adam
Adam il 1 Set 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.

Categorie

Scopri di più su Software Development Tools in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by