change text in a msgbox

28 visualizaciones (últimos 30 días)
Michael
Michael el 28 de Jul. de 2011
Comentada: David Thoen el 8 de Oct. de 2020
Hi everyone. I have a msgbox pop up with some information for the user, and I'd like to change the text at different points in the program so the user know whats going on. I could just close the msgbox and create a new one, but I thought it might be a little more elegant to just change the text. Is this possible?
Michael

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 28 de Jul. de 2011
% Create a msgbox
h = msgbox('Hi');
% Change just the message
set(findobj(h,'Tag','MessageBox'),'String','How are you?')
% Make the pushbutton invisible
set(findobj(h,'style','pushbutton'),'Visible','off')
If the user closes the message box then you should create a new one.
On the other hand you can just create a modal msgbox that follows the first one and replaces it:
msgbox('Hi');
msgbox('How are you','modal');
  3 comentarios
Vyshakh Pv
Vyshakh Pv el 26 de Feb. de 2020
How to change the text in title bar of the same message box?
David Thoen
David Thoen el 8 de Oct. de 2020
msgbox('text','Title','icon')
please check 'doc msgbox' to find out more about title and icon.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by