<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/257746</link>
    <title>MATLAB Central Newsreader - Changing color of specific text in a textbox?</title>
    <description>Feed for thread: Changing color of specific text in a textbox?</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>Tue, 04 Aug 2009 18:42:05 -0400</pubDate>
      <title>Changing color of specific text in a textbox?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/257746#670602</link>
      <author>Keith Gould</author>
      <description>This will either be really simple, or practically impossible.  So lets say I have the following code...&lt;br&gt;
&lt;br&gt;
str1=strcat('SD=', randomVar1);&lt;br&gt;
str2=strcat('zscore=', randomVar2);&lt;br&gt;
str3=strcat('R^2=', randomVar3);&lt;br&gt;
set(textBox, 'String', [str1, char(10), str2, char(10), str3], 'BackgroundColor', [1 1 1], 'Position', [.84 .105 .135 sizestat], 'FontSize', 8, 'HorizontalAlignment', 'left');&lt;br&gt;
&lt;br&gt;
This will create some textbox on my figure that will look sort of like this (presuming my text doesn't get mangled):&lt;br&gt;
--------------------------------&lt;br&gt;
|   SD=X.XXX             |&lt;br&gt;
|   zscore=-X.XXX       |&lt;br&gt;
|   R^2=X.XXX           |&lt;br&gt;
--------------------------------&lt;br&gt;
&lt;br&gt;
and of course, presume that I have some numerical values for randomVar1, 2 and 3... they've been represented as X.XXX or -X.XXX.&lt;br&gt;
&lt;br&gt;
Since it's really hard to see the negative sign in the figure I would like to add colors to certain portions of the text in the textbox, but not all of it.  Ideally, I want to color green for positive and red for negative values.&lt;br&gt;
&lt;br&gt;
So im wondering if its possible to color a certain portion of the text such as just the &quot;SD=X.XXX&quot; section?&lt;br&gt;
&lt;br&gt;
Thanks for any help in advance!!&lt;br&gt;
&lt;br&gt;
-Keith</description>
    </item>
  </channel>
</rss>

