How Do I Extract User Inputs From a UIFigure?
Mostrar comentarios más antiguos
I am trying to make a window with several checkboxes, and an OK button. I want the state of the checkboxes to be saved in memory when the user closes the window with the OK button. As soon as the figure closes, the data is gone. And I cannot figure out how to extract the data from the close function handle itself. Do I need to create a 'ValueChangedFcn' for each checkbox and change it in real time?
Respuesta aceptada
Más respuestas (2)
Voss
el 25 de Jul. de 2023
1 voto
To save the state when the uifigure is closed, specify a CloseRequestFcn for the uifigure that gets the state of each checkbox and saves that information to file (e.g., a mat file or a text file).
To restore the state when re-opening the uifigure:
- if it's in an app, specify a startupFcn for the app that reads the file you saved and sets the state of the checkboxes
- if it's not in an app, read the file in the script or function that creates the uifigure and set the state of the checkboxes when they are created
Brandon
el 26 de Jul. de 2023
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!