how to get an output from this dialog box?
2 次查看(过去 30 天)
显示 更早的评论
I am sure I am making just a plain old dumb mistake but how in the world do I gan an answer/output from this? It pops up, respones, but when it's gone I don't have any value from the box at all :(
function correctdialoguefontsize
d = dialog('Position',[700 500 250 150],'Name','');
%coordinates are x,y,length,height
txt = uicontrol('Parent',d,...
'Style','text',...
'Position',[20 90 210 40],...
'String','Which emotion do you recognize?');
txt.FontSize = 12;
btn = uicontrol('Parent',d,...
'Position',[40 70 70 25],...
'String','Angry',...
'Callback','delete(gcf)');
btn.FontSize = 12;
btn = uicontrol('Parent',d,...
'Position',[120 70 70 25],...
'String','Fearful',...
'Callback','delete(gcf)');
btn = uicontrol('Parent',d,...
'Position',[40 30 70 25],...
'String','Happy',...
'Callback','delete(gcf)');
btn = uicontrol('Parent',d,...
'Position',[120 30 70 25],...
'String','Sad',...
'Callback','ans=sad');
end
0 个评论
回答(1 个)
Vimal Rathod
2020-2-26
You could use a Global variable, assign that variable in the callback function and you could retrieve the variable in your program.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!