Azzera filtri
Azzera filtri

Writing ~ using fprintf

5 visualizzazioni (ultimi 30 giorni)
David Corella López
David Corella López il 13 Dic 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.

Risposta accettata

Jan
Jan il 13 Dic 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 Commenti
David Corella López
David Corella López il 13 Dic 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 il 13 Dic 2020
Ok. I've already solved it. Thanks!

Accedi per commentare.

Più risposte (0)

Tag

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by