Displaying a saved value in plot's textbox.

6 Ansichten (letzte 30 Tage)
Katarina
Katarina am 14 Jan. 2015
Beantwortet: Sara am 14 Jan. 2015
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.

Antworten (1)

Sara
Sara am 14 Jan. 2015
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.

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by