Displaying a saved value in plot's textbox.

6 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by