How does one retain data in an input dialog box
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a way to retain data in an input dialog box after it is cancled? I want the user input data to show up the next time that the user opens the dialog box. Is this a possibility, and if it is can a sample code please be provided thanks.
0 commentaires
Réponse acceptée
Jan
le 11 Juil 2013
You can add this code to the CloseRequestFcn of the GUI:
String = get(handles.editH, 'String');
save(fullfile(prefdir, 'MyGUI.pref'), 'String', '-MAT');
And in the OpeningFcn:
PrefFile = fullfile(prefdir, 'MyGUI.pref');
if exist(PrefFile, 'file')
FileData = load(PrefFile, '-MAT');
set(handles.editH, 'String', FileData.String);
end
0 commentaires
Plus de réponses (2)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!