필터 지우기
필터 지우기

LaTex with 2 strings separated by a num2str

조회 수: 5 (최근 30일)
Jacob Yarinsky
Jacob Yarinsky 2019년 4월 19일
댓글: Star Strider 2019년 4월 19일
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

채택된 답변

Star Strider
Star Strider 2019년 4월 19일
Try this:
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];
It seems you need to ‘escape’ the ‘%’.
  댓글 수: 2
Jacob Yarinsky
Jacob Yarinsky 2019년 4월 19일
Thanks
Star Strider
Star Strider 2019년 4월 19일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David Wilson
David Wilson 2019년 4월 19일
Use an escape (backslash) for the %
errordisplay=[' $\varepsilon_{RTP}=$ ',num2str(rtep),'\%'];

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by