a memory for the change on a dialog box

Hello everyone,
I wrote a dialog box with some popup menus (using uicontrol) to allow the modifications of the block parameters on simulink (set_param()), it works fine but when I close the dialog box and I reopen it, the block parameters are in agreement to the last change, instead the dialog box has been resetted at the default values
Is there a way to keep trace of the current status of a dialog box and store it for the next opening of the dialog box ?
[EDITED, JSimon, copied from answer section]:
Until now I wrote that, but I'm still not able to store the status What is wrong?
f = figure('menubar','none','Position',[360,500,450,285]);
myhandlesYup = guihandles(f);
uicontrol(tab1,'Style','popupmenu',...
'String',{'Yes','No'},...
'Position',[200,30,100,210-(i)*25],...
'Callback',{@popup_menu_Callback,myhandlesYup, anx});
function popup_menu_Callback(source,eventdata,myhandlesYup,anx)
% Determine the selected data set.
str = get(source, 'String')
val = get(source,'Value')
anx
% Set current data to the selected data set.
switch str{val};
case 'Yes' % User selects Peaks.
set_param(gcb,strcat('Int_',anx),'1')
myhandlesYup.(genvarname(anx))=1
case 'No' % User selects Membrane.
set_param(gcb,strcat('Int_',anx),'0')
myhandlesYup.(genvarname(anx))=0
end
guidata(gcbo,myhandlesYup)
end

1 Comment

Adding the code as an answer is less readable than inserting it into the original question.

Sign in to comment.

Answers (1)

Jan
Jan on 12 Apr 2012
Yes. You can store the current settings in the CloseReqestFcn callback, e.g. in a file inside the prefdir path. Then these settings can be set as defaults, when the dialog is opened the next time.

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

B
B
on 12 Apr 2012

Community Treasure Hunt

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

Start Hunting!