Getting values out of uicontrol edit
38 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
Prabhanjan Mentla
2020 年 9 月 25 日
Hi,
Callbacks and sharing data among callbacks are necessary in order to get the values from the dialog box.
Hope this helps.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!