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

61 vues (au cours des 30 derniers jours)
Jørgen
Jørgen le 4 Déc 2013
Commenté : Walter Roberson le 25 Déc 2017
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.

Réponse acceptée

sixwwwwww
sixwwwwww le 4 Déc 2013
use
legend(strcat('Some text', num2str(someValue)))
  3 commentaires
Ankita Kule
Ankita Kule le 25 Déc 2017
Thank you. :)
Walter Roberson
Walter Roberson le 25 Déc 2017
legend( sprintf('Some text %g', someValue) )

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by