how to get an output from this dialog box?

3 vues (au cours des 30 derniers jours)
michael woodcock
michael woodcock le 23 Fév 2020
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

Réponses (1)

Vimal Rathod
Vimal Rathod le 26 Fév 2020
You could use a Global variable, assign that variable in the callback function and you could retrieve the variable in your program.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by