Best way to save a lot of user choices as variables in a GUI
1 view (last 30 days)
Show older comments
Manuel Olschner
on 22 Apr 2016
Commented: Manuel Olschner
on 27 Apr 2016
I am working on a large project in Matlab that works with an Access and MySQL database as with an exchange of data from a FTP Server. The code was written by five to six people over the last few years. My task up until now was mainly to design the GUIs for this.
The purpose of this project ist to automate a simulation within another program. Matlab works as interafce between the user, the databases and the simulation program. Evaluation and visualisation of the results will also be progressed in Matlab.
The user is interacting with Matlab via my GUIs. Due to this, a large amount of variables are needed to save the users‘ choice or read/save data (between 40-70 per GUI). I created about nine GUIs, one for connection, several for simulation setup, evaluation and so on.
How are those variables best saved (within the GUIs)? Are there articles or tutorials for projects like this?
I am talking about IDs for example or check box choices but also small matrices. Really big matrices are saved via csv. The problem at the moment is that the code is drowning in small database querys for every pushbutton as it was not written very consistant. I want to fix that. I would like to only have a minimum amount of querys per variable, like a query in the opening function for example.
I’ve seen some approaches like saving it as structs in the handles or using global variables.
Thanks in advance. If you need further information feel free to ask. Also i welcome every guide, tutorial or articles for cases like this.
2 Comments
Geoff Hayes
on 24 Apr 2016
Manuel - I think that saving the data (IDs or small matrices) to the handles structure is a good/typical way forward. See store or retrieve UI data for examples on how to use this structure.
As for determining the (say) check box choice, then use the check box handle found in the handles structure to access that choice. For example, if the checkbox is named checkbox1, then you would do something like
val = get(handles.checkbox1,'Value');
where val would be 0 or 1 depending upon whether the checkbox is disabled or not respectively.
Accepted Answer
Geoff Hayes
on 24 Apr 2016
Manuel - I think that saving the data (IDs or small matrices) to the handles structure is a good/typical way forward. See store or retrieve UI data for examples on how to use this structure.
As for determining the (say) check box choice, then use the check box handle found in the handles structure to access that choice. For example, if the checkbox is named checkbox1, then you would do something like
val = get(handles.checkbox1,'Value');
where val would be 0 or 1 depending upon whether the checkbox is disabled or not respectively.
0 Comments
More Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!