MATLAB: How to make the GUIDE GUI remember property values for ActiveX controls

MATLAB

I am using ActiveX controls in my GUIDE GUI, like Microsoft Date Picker. How can I make the GUI remember the values for properties like Format?

Best Answer

Choose one of the following options, and add the code before the call to "guidata" command at the end of the "OpeningFcn".
Try adding property setting code for the ActiveX control directly in the GUI "OpeningFcn". For example:
set(handles.activex1, 'Format', 'dtpTime');
where "activex1" is the handle to the ActiveX control object.
OR
Remove the ActiveX control from the GUI, create a new one, and set all of its properties in the GUI "OpeningFcn". For example:
handles.datecontrol = actxcontrol('MSComCtl2.DTPicker', 'Position',[100 100 100 25]);
set(handles.datecontrol,'Format','dtpTime');