Displaying a saved value in plot's textbox.

6 ビュー (過去 30 日間)
Katarina
Katarina 2015 年 1 月 14 日
回答済み: Sara 2015 年 1 月 14 日
I've calculated area under the curve and saved it under 'a'. I'm using annotation function in MATLAB such that
annotation(figure1,'textbox',[0.643 0.22 0.5 0.1],'String','Area_s_s = ','FitBoxToText','on');
After the Area_s_s I want to display the saved value a and I though that if INSERT = a,'kJm^-3' such that
annotation(figure1,'textbox',[0.643 0.22 0.5 0.1],'String','Area_s_s = ',INSERT,'FitBoxToText','on');
I will be able to call up the saved value a and add the units afterwards but it's not working.
All I basically want to do is add a previously calculated area under the curve on the plot in a function so that I don't have to do it manually since I have quite a few data to go through. I'm new to using textbox function and I am very much open to any suggestions you might have to achieve this in a different way.
Thank you in advance for taking time to read my question.

回答 (1 件)

Sara
Sara 2015 年 1 月 14 日
Replace:
'Area_s_s = '
with
['Area_s_s = ',num2str(a),'kJm^-3']
in the annotation. It's also better if you use sprintf instead of num2str so you can control the number format.

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by