How does one retain data in an input dialog box

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.

 채택된 답변

Jan
Jan 2013년 7월 11일

0 개 추천

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

추가 답변 (2개)

Timothy
Timothy 2013년 7월 11일

0 개 추천

Is this code added to the inputdlg.m? If so there are no real seperate functions only different uicomponents that are added to the gui, so where is the OpeningFcn. Or is it added to the section of my code which calls to inputdlg.m? Even then wehre is the CloseRequestFcn. Thank you
Timothy
Timothy 2013년 7월 11일

0 개 추천

Nevermind I figured it out. Thanks a ton for the help, great piece of coding.

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

질문:

2013년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by