Borrar filtros
Borrar filtros

Writing ~ using fprintf

5 visualizaciones (últimos 30 días)
David Corella López
David Corella López el 13 de Dic. de 2020
Comentada: David Corella López el 13 de Dic. de 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.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by