Multiple lines in msgbox
76 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Amani
le 24 Déc 2011
Commenté : Image Analyst
le 19 Déc 2018
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 commentaire
Image Analyst
le 19 Sep 2018
Isn't that basically just what Walter already said below (7 years ago)?
Réponse acceptée
Walter Roberson
le 24 Déc 2011
uiwait(msgbox({'line1';'line2';'line3';'line4' } ,'About !','modal'));
Plus de réponses (1)
Image Analyst
le 24 Déc 2011
message = sprintf('Line1\nLine2\nLine3\nLine4');
uiwait(msgbox(message));
2 commentaires
Le Dung
le 19 Déc 2018
How can i change fontsize or color of line1,line2....line4 in msgbox???
Thank you so much
Image Analyst
le 19 Déc 2018
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()
Voir également
Catégories
En savoir plus sur Display and Exploration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!