Using an apostrophe with fprintf
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Megan Lavery
le 16 Fév 2015
Réponse apportée : Roger Stafford
le 16 Fév 2015
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 commentaires
Réponse acceptée
Image Analyst
le 16 Fév 2015
Use a double single quote character to print a single quote character:
fprintf('Avogadro''s constant is 6.022e+23 molecules/mole.\n')
0 commentaires
Plus de réponses (1)
Roger Stafford
le 16 Fév 2015
Use double apostrophe just as you would in any matlab string:
fprintf('Avogadro''s constant is 6.022e+23 molecules/mole.\n')
0 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings 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!