How can I add both numbers and text as legend in a plot?

조회 수: 188 (최근 30일)
Jørgen
Jørgen 2013년 12월 4일
댓글: Walter Roberson 2017년 12월 25일
I have a matrix called x, which contains 8 numbers. I have then a plot, and I can get the numbers as legend by writing legend(num2str(x(1)),.....), but I also want one letter after each number in the legend. Have tried to write legend(num2str(x(1)) 'V',.....) etc. but with no success. Have searched a while after a solution, but can't find any.

채택된 답변

sixwwwwww
sixwwwwww 2013년 12월 4일
use
legend(strcat('Some text', num2str(someValue)))
  댓글 수: 3
Ankita Kule
Ankita Kule 2017년 12월 25일
Thank you. :)
Walter Roberson
Walter Roberson 2017년 12월 25일
legend( sprintf('Some text %g', someValue) )

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

추가 답변 (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