Using an apostrophe with fprintf
조회 수: 22 (최근 30일)
이전 댓글 표시
How do I include an apostrophe within my text while using the fprintf command? For example, fprintf('Avogadro's constant is 6.022e+23 molecules/mole.\n') will not work because the apostrophe in "Avogadro's" ends the text segment.
댓글 수: 0
채택된 답변
Image Analyst
2015년 2월 16일
Use a double single quote character to print a single quote character:
fprintf('Avogadro''s constant is 6.022e+23 molecules/mole.\n')
댓글 수: 0
추가 답변 (1개)
Roger Stafford
2015년 2월 16일
Use double apostrophe just as you would in any matlab string:
fprintf('Avogadro''s constant is 6.022e+23 molecules/mole.\n')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!