# How can I add text, containing a matrix, to a plot?

27 views (last 30 days)
Jens Weber on 30 Jul 2017
Edited: dpb on 31 Jul 2017
How can I add text, containing a matrix, to a plot?
##### 2 CommentsShowHide 1 older comment
Jens Weber on 31 Jul 2017
Edited: dpb on 31 Jul 2017
thanks for your comment as well. In the meanwhile a found the following answer:
A = [ 1 2; 3 4 ]
str = [ 'Transformationsmatrix \it{A} = ', '$$\left[ {\matrix{ ',num2str(A(1,1)),' & ', num2str(A(1,2)),... ' \cr ', num2str(A(2,1)) , ' & ', num2str(A(2,2)),' } } \right]$$' ];
title(str,'Interpreter','latex')

Jan de Jong on 31 Jul 2017
Do you mean something like this? text(1,1,[num2str(magic(3))])
Jens Weber on 31 Jul 2017
Hello Jan, thanks for your answer. in the meanwhile I found the following solution:
A = [ 1 2; 3 4 ] str = [ 'Transformationsmatrix \it{A} = ', '$$\left[ {\matrix{ ',num2str(A(1,1)),' & ', num2str(A(1,2)),... ' \cr ', num2str(A(2,1)) , ' & ', num2str(A(2,2)),' } } \right]$$' ]; title(str,'Interpreter','latex')

### Categories

Find more on Annotations in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!