Multiple lines in msgbox
76 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(1 个)
Image Analyst
2011-12-24
message = sprintf('Line1\nLine2\nLine3\nLine4');
uiwait(msgbox(message));
2 个评论
Le Dung
2018-12-19
How can i change fontsize or color of line1,line2....line4 in msgbox???
Thank you so much
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()
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Display and Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!