I supposed to assign the entered strings or chosen values to a struct in the callback functions. I have something like below but I cannot embed it into function. In command window, matlab returns me some numerical values rather than responses
function bd = dialog('Position',[300 300 300 300],'Name','My Dialog');Name = uicontrol('Parent',d,... 'Style','text',... 'Position',[20 180 50 100 ],... 'String','Name');NameAns = uicontrol('Parent', d,... 'Style', 'edit',... 'String','Type Your Name',... 'position', [70 260 100 20] )Gender = uicontrol('Parent',d,... 'Style','text',... 'Position',[20 150 50 100 ],... 'String','Gender');GenderAns = uicontrol('Parent', d,... 'Style', 'popup', 'String', {'female','male', 'other'},... 'Position', [70 230 90 20 ])Color = uicontrol('Parent',d,... 'Style','text',... 'Position',[20 120 50 100 ],... 'String','Favorite Color');ColorAns = uicontrol('Parent', d,... 'Style', 'popup', 'String', {'Blue','Red', 'Orange'},... 'Position', [70 200 90 20 ])uicontrol('Parent', d, 'Style', 'pushbutton',... 'String', 'OK',... 'Position', [90, 90, 110, 30],... 'FontSize',18,'Callback',@OKCallBack);function ConfCallBack(source,eventdata) disp(get(source,'Value'));subject.name = NameAnssubject.gender = GenderAnssubject.color = ColorAns uiwait (d) end function OKCallBack(source,eventdata) close(d) endend
Best Answer