how to print values in graph window values in graph window

I was wondering if there is an equivalent of the 'fprint' function that would print values in graph window instead of in work space. In other words, when I run the script that simply calculates x=X_m*sin(w*t), I want to display the values of X_m and w in small text box somewhere in figure window instead of in work space. And of course, I want this to be displayed automatically without clicking on the graph.
Thanks

 채택된 답변

the cyclist
the cyclist 2013년 7월 20일
You can use the text() function to write text on a figure.
doc text
for details.

댓글 수: 3

Thanks. Now I have this situation:
text(350,-5,'FUNDAMENTAL HARMONIC = '); text(350,-10,'SNR = '); text(350,-15,'THD = '); text(350,-20,'SINAD = '); text(350,-25,'SFDR = ');
I want to append the value to each of them after equality sign, which is calculated as double. I tried it same way as with 'fprint' and 'disp' but it didn't work.
For example, you can do
text(x,y,['SFDR = ',num2str(sfdr)])
where the variable sfdr has the value you want to display.
You could use sprintf() in place of num2str() as well, to get more control over the output.
Thanks, that totally worked!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Language Support에 대해 자세히 알아보기

태그

질문:

2013년 7월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by