MATLAB: How can we add different lines in msgbox with different lengths

msgbox

How can we add different lines in msgbox with different lengths? We cant use () these brackets neither brackets used in cell array so what is the option?

Best Answer

Use sprintf and \n. For example:
message = sprintf('This is line 1.\nThe date is %s', date)
msgbox(message);