how to get an output from this dialog box?

4 visualizaciones (últimos 30 días)
michael woodcock
michael woodcock el 23 de Feb. de 2020
Respondida: Vimal Rathod el 26 de Feb. de 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

Respuestas (1)

Vimal Rathod
Vimal Rathod el 26 de Feb. de 2020
You could use a Global variable, assign that variable in the callback function and you could retrieve the variable in your program.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by