<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265291</link>
    <title>MATLAB Central Newsreader - How to add a variable as a text?</title>
    <description>Feed for thread: How to add a variable as a text?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 08 Nov 2009 14:02:03 -0500</pubDate>
      <title>How to add a variable as a text?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265291#693005</link>
      <author>Michael </author>
      <description>i have this problem that i want to add a text to my plot, i already know this command text(x,y,'string'). The problem is i want to put a variable instead of the string. Shall i try another command or what?</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 14:06:47 -0500</pubDate>
      <title>Re: How to add a variable as a text?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265291#693006</link>
      <author>ImageAnalyst</author>
      <description>On Nov 8, 9:02&#160;am, &quot;Michael &quot; &amp;lt;haj...@kth.se&amp;gt; wrote:&lt;br&gt;
&amp;gt; i have this problem that i want to add a text to my plot, i already know this command text(x,y,'string'). The problem is i want to put a variable instead of the string. Shall i try another command or what?&lt;br&gt;
&lt;br&gt;
------------------------------------------------------------------------&lt;br&gt;
So just pass in a string variable instead of a literal.  You can use&lt;br&gt;
sprintf() if you need to embed a numerical variable in the string&lt;br&gt;
variable, like this:&lt;br&gt;
annotationText = sprintf('The value is %.2f\nIs that great or what?',&lt;br&gt;
numericalVariable);&lt;br&gt;
text(x,y, annotationText);</description>
    </item>
  </channel>
</rss>

