Best way to save a lot of user choices as variables in a GUI
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Geoff Hayes
2016-4-24
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.
采纳的回答
Geoff Hayes
2016-4-24
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!