Adding new line in text property
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I add a new line before each paragraph in the Text property of the Header in a getHeaderImpl method with system object?
I tried (\n) , but it did not work.
2 commentaires
Réponse acceptée
Plus de réponses (1)
Marie Anna NOVIELLO
le 27 Mar 2025
Try to use the newline function:
function header = getHeaderImpl(obj)
header = [newline, 'First paragraph', newline, newline, 'Second paragraph', newline, newline, 'Third paragraph'];
end
or
Try to use the sprintf function:
function header = getHeaderImpl(obj)
header = sprintf('\n%s\n\n%s\n\n%s', 'First paragraph', 'Second paragraph', 'Third paragraph');
end
Voir également
Catégories
En savoir plus sur Text Files 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!