Adding new line in text property
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
その他の回答 (1 件)
Marie Anna NOVIELLO
2025 年 3 月 27 日
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
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!