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!