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

 採用された回答

Oleg Komarov
Oleg Komarov 2011 年 7 月 28 日

2 投票

% 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 件のコメント

Michael
Michael 2011 年 7 月 29 日
Thanks Oleg! The first method you suggest is perfect.
Michael
Vyshakh Pv
Vyshakh Pv 2020 年 2 月 26 日
How to change the text in title bar of the same message box?
David Thoen
David Thoen 2020 年 10 月 8 日
msgbox('text','Title','icon')
please check 'doc msgbox' to find out more about title and icon.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2011 年 7 月 28 日

コメント済み:

2020 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by