Multiple lines in msgbox

33 ビュー (過去 30 日間)
Amani
Amani 2011 年 12 月 24 日
コメント済み: Image Analyst 2018 年 12 月 19 日
How can i write multiple lines in msgbox ?
here it is just write in 2 lines ! .. but i need more than 2 lines : (
uiwait(msgbox({'line1';'line2' } ,'About !','modal'));
  1 件のコメント
Image Analyst
Image Analyst 2018 年 9 月 19 日
Isn't that basically just what Walter already said below (7 years ago)?

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

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 24 日
uiwait(msgbox({'line1';'line2';'line3';'line4' } ,'About !','modal'));
  1 件のコメント
Amani
Amani 2011 年 12 月 24 日
Thanxxxxx alote walter ^_^

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2011 年 12 月 24 日
message = sprintf('Line1\nLine2\nLine3\nLine4');
uiwait(msgbox(message));
  2 件のコメント
Le Dung
Le Dung 2018 年 12 月 19 日
How can i change fontsize or color of line1,line2....line4 in msgbox???
Thank you so much
Image Analyst
Image Analyst 2018 年 12 月 19 日
You have to create a structure that you pass in to msgbox(). See this function msgboxw() that puts up a message with fontsize 14. Adapt as needed.
function msgboxw(message)
try
CreateStruct.Interpreter = 'tex';
CreateStruct.WindowStyle = 'modal';
% CreateStruct.Title = 'MATLAB Message';
fontSize = 14;
% Embed the required tex code in before the string.
latexMessage = sprintf('\\fontsize{%d} %s', fontSize, message);
uiwait(msgbox(latexMessage, 'MATLAB message', CreateStruct));
catch ME
errorMessage = sprintf('Error in msgboxw():\n%s', ME.message);
fprintf('%s\n', errorMessage);
uiwait(warndlg(errorMessage));
end
return; % from msgboxw()

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by