Filter löschen
Filter löschen

Writing ~ using fprintf

5 Ansichten (letzte 30 Tage)
David Corella López
David Corella López am 13 Dez. 2020
Hello to everyone.
The point of this question is how to write the character ~ when using fprintf.
When I write it, I get the following message:
Warning: Escaped character '\~' is not valid.
Moreover, I'm wondering how to add a text before a mathematical expression, i.e.:
fprintf(f,'\~y\~-\~w %.6E & %.6E & %.6E & %.6E\\\\',A(1, :));
What sould I do in order to write that?
Thank you very much.

Akzeptierte Antwort

Jan
Jan am 13 Dez. 2020
The tilde can be printed directly without escaping:
fprintf('This is a tile: ~\n')
And what is the problem with adding text?
fprintf(f,'~y~-~w %.6E & %.6E & %.6E & %.6E\\\\', A(1, :));
  2 Kommentare
David Corella López
David Corella López am 13 Dez. 2020
Hello.
Firstly, thanks for your answer!
I didn't explain myself well enough.
Now, I've realized the problem is not really with the tilde but with the bar \. I need to print it, too, in order to write it in LaTeX.
David Corella López
David Corella López am 13 Dez. 2020
Ok. I've already solved it. Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by