How to append lines to an existing MessageBox

8 ビュー (過去 30 日間)
Fabio Pasquarella
Fabio Pasquarella 2017 年 12 月 21 日
回答済み: Ramnarayan Krishnamurthy 2017 年 12 月 29 日
Hello, my output is written on a msgbox. Later in the program I need to append some more output lines. How can i perform this? Thank you

回答 (1 件)

Ramnarayan Krishnamurthy
Ramnarayan Krishnamurthy 2017 年 12 月 29 日
The following is a possible approach to append messages in the msgbox after its creation.
% Create a message box
h = msgbox('Hi');
% Set the size of the msgbox to accommodate more lines
set(h,'units','normalized' ,'position', [0.5 0.5 0.2 0.2])
% Find the text in the msgbox using the tag to identify the msgbox
a = findobj(h,'Tag','MessageBox')
% Append lines below
a.String{end+1} = 'Line 1 Added';
a.String{end+1} = 'Line 2 Added';
% Add extra text in the same line
a.String{end} = a.String{end}+" "+ "More text..."
To include a variable in the message box, the link below may help:

カテゴリ

Help Center および File ExchangeText Analytics Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by