LaTex with 2 strings separated by a num2str

3 visualizaciones (últimos 30 días)
Jacob Yarinsky
Jacob Yarinsky el 19 de Abr. de 2019
Comentada: Star Strider el 19 de Abr. de 2019
Hi all, I have what I hope to be a simple question. This is the code I am working on now.
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),];
text(30,15,errordisplay,'interpreter','latex')
I want to add a percent sign after the conversion of 'rtep'. But when I do this
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'%'];
the conversion of ' $\varepsilon_{RTP}=$ ' goes away and leaves the string as typed.
Any ideas?
Thanks in advance

Respuesta aceptada

Star Strider
Star Strider el 19 de Abr. de 2019
Try this:
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];
It seems you need to ‘escape’ the ‘%’.
  2 comentarios
Jacob Yarinsky
Jacob Yarinsky el 19 de Abr. de 2019
Thanks
Star Strider
Star Strider el 19 de Abr. de 2019
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (1)

David Wilson
David Wilson el 19 de Abr. de 2019
Use an escape (backslash) for the %
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by