Correct Sprintf use on legend

조회 수: 10 (최근 30일)
Jose
Jose 2012년 9월 20일
Hi, I'm plotting 3 things. I want to make a box legend inside the plot but cant find the right way to do it, I want the third legend say:
CI = Ddata(1) +- 10%
The code is the next:
rango=10
legend('Original Data','CI=Ddata(1)',sprintf('CI = Ddata(1) \pm %.1e',rango),4);
It doesnt create the legend and give this on the Command Window:
Warning: Invalid escape sequence appears in format string. See help
sprintf for valid escape sequences.
Any help is appreciated.

채택된 답변

Matt Fig
Matt Fig 2012년 9월 20일
편집: Matt Fig 2012년 9월 20일
Use:
\\pm % The first \ escapes the use of the escape \.
instead of:
\pm
  댓글 수: 1
Jose
Jose 2012년 9월 29일
Thanks, I focused on other parts of my code and forget about this.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by