Add text and matrix in a figure

Hi everyone, I run a code and the result is matrix (1x6) and a curve. I want to plot the curve and have as a legend the matrix with a text. How is that possible? Thanks

Antworten (2)

Thorsten
Thorsten am 16 Jan. 2013

0 Stimmen

x = rand(1, 6); % sample data
plot(x)
legend('my curve')

1 Kommentar

Natalia
Natalia am 16 Jan. 2013
Ok thanks for the answer. What I want to do is to have as table(3x3) with the curve like this: text1 rand(1,1) rand(1,2); text2 rand(1,3)rand(1,4); text3 rand(1,5) rand(1,6);

Melden Sie sich an, um zu kommentieren.

Shashank Prasanna
Shashank Prasanna am 16 Jan. 2013

0 Stimmen

Here is a work around albeit crude:
plot(rand(5,1)),legend({['1' ' 2' char(10) '3' ' 4' ]})
char(10) adds the new line

2 Kommentare

Natalia
Natalia am 16 Jan. 2013
Thanks! It works. I want also to ask you if I don't want to have the lines in legend is that possible?
Natalia
Natalia am 16 Jan. 2013
Also if the '1' '2' ... are cells of a matrix can I have A(1,1) instead of the numbers?

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 16 Jan. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by