MATLAB: Getting values out of uicontrol edit

uicontroluicontrol edit

Hi all,
i wanted to make my inputdlg box prettier and easier to work with. Therefore i used uicontrols edits and buttons and i managed to create the design i'm happy with. But how do i get the values from the edit boxes. All don't get how the Callback functions work. I need help!
Here is the code for clearity:
function yourDlg()
input = struct;
d = dialog('Position', [800, 400, 200, 450]);
uicontrol(d,'Style','text',...
'String','General Parameters',...
'Position',[25 400 150 30],...
'FontWeight','bold');
uicontrol(d,'Style','text',...
'String','Peak',...
'Position',[25 375 150 30]);
input.peak = uicontrol(d,'Style','edit',...
'String','0002',...
'Position',[25 350 150 30],...
'Callback','DeleteFcn');
uicontrol(d,'Style','text',...
'String','angle to surface [°]',...
'Position',[25 275 150 30]);
input.angle = uicontrol(d,'Style','edit',...
'String','0',...
'Position',[25 250 150 30]);
uicontrol(d,'Style','text',...
'String','Data set',...
'Position',[25 175 150 30]);
input.omega = uicontrol(d,'Style','radiobutton',...
'String','Omega',...
'Position',[50 150 70 30],...
'HandleVisibility','off');
input.RSM = uicontrol(d,'Style','radiobutton',...
'String','RSM',...
'Position',[120 150 70 30],...
'HandleVisibility','off');
uicontrol(d,'Style','text',...
'String','Radiation wavelength [angstr]',...
'Position',[25 75 150 30]);
input.lambda = uicontrol(d,'Style','edit',...
'String','1.54056',...
'Position',[25 50 150 30]);
uicontrol(d,...
'Position',[62 10 75 30],...
'String','Close',...
'Callback','delete(gcf)');
end

Best Answer

Hi,
Callbacks and sharing data among callbacks are necessary in order to get the values from the dialog box.
To fetch the data from UI control dialog box, you may refer something like this.
This following link helps better in structuring the uicontrol dialog box.
Hope this helps.