Using an apostrophe with fprintf
25 次查看(过去 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!