<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139</link>
    <title>MATLAB Central Newsreader - Adding Text columns to a Matrix</title>
    <description>Feed for thread: Adding Text columns to a Matrix</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>Wed, 17 Sep 2008 18:41:03 -0400</pubDate>
      <title>Adding Text columns to a Matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139#600744</link>
      <author>Raju Gain</author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I have created a variable A = zeros(5,5). The first three columns contain double values. I have another variable which contains strings for example 'Yes' or 'No'. I am trying to add this variable to A(:,4) (to make it as the fourth column) but I keep getting an error which says &quot; The following error occurred converting from cell to double:&lt;br&gt;
Error using ==&amp;gt; double&lt;br&gt;
Conversion to double from cell is not possible.&quot;&lt;br&gt;
&lt;br&gt;
I am not sure what I am doing wrong. It should be quite straight forward. Can someone help?&lt;br&gt;
&lt;br&gt;
Thanks</description>
    </item>
    <item>
      <pubDate>Wed, 17 Sep 2008 18:55:04 -0400</pubDate>
      <title>Re: Adding Text columns to a Matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139#600747</link>
      <author>Barry Williams</author>
      <description>&quot;Raju Gain&quot; &amp;lt;supernova5271@yahoo.com&amp;gt; wrote in message &amp;lt;garivv$sni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have created a variable A = zeros(5,5). The first three columns contain double values. I have another variable which contains strings for example 'Yes' or 'No'. I am trying to add this variable to A(:,4) (to make it as the fourth column) but I keep getting an error which says &quot; The following error occurred converting from cell to double:&lt;br&gt;
&amp;gt; Error using ==&amp;gt; double&lt;br&gt;
&amp;gt; Conversion to double from cell is not possible.&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am not sure what I am doing wrong. It should be quite straight forward. Can someone help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&lt;br&gt;
Search the documentation for information on creating a cell array.  This will hold both numerical and text data.&lt;br&gt;
Barry</description>
    </item>
    <item>
      <pubDate>Wed, 17 Sep 2008 19:01:03 -0400</pubDate>
      <title>Re: Adding Text columns to a Matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139#600748</link>
      <author>someone </author>
      <description>&quot;Raju Gain&quot; &amp;lt;supernova5271@yahoo.com&amp;gt; wrote in message &amp;lt;garivv$sni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have created a variable A = zeros(5,5). The first three columns contain double values. I have another variable which contains strings for example 'Yes' or 'No'. I am trying to add this variable to A(:,4) (to make it as the fourth column) but I keep getting an error which says &quot; The following error occurred converting from cell to double:&lt;br&gt;
&amp;gt; Error using ==&amp;gt; double&lt;br&gt;
&amp;gt; Conversion to double from cell is not possible.&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am not sure what I am doing wrong. It should be quite straight forward. Can someone help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&lt;br&gt;
% This should get you started:&lt;br&gt;
&lt;br&gt;
A = zeros(5,5)&lt;br&gt;
B = num2cell(A)&lt;br&gt;
&lt;br&gt;
B{4,1} = 'yes'&lt;br&gt;
B{1,4} = 'no'&lt;br&gt;
&lt;br&gt;
% etc.</description>
    </item>
    <item>
      <pubDate>Wed, 17 Sep 2008 19:05:06 -0400</pubDate>
      <title>Re: Adding Text columns to a Matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139#600749</link>
      <author>Walter Roberson</author>
      <description>&quot;Raju Gain&quot; &amp;lt;supernova5271@yahoo.com&amp;gt; wrote in message &amp;lt;garivv$sni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt; I have created a variable A = zeros(5,5). The first three &lt;br&gt;
&amp;gt; columns contain double values. I have another variable &lt;br&gt;
&amp;gt; which contains strings for example 'Yes' or 'No'. I am&lt;br&gt;
&amp;gt; trying to add this variable to A(:,4)&lt;br&gt;
&lt;br&gt;
You cannot mix data classes in a single array. You cannot&lt;br&gt;
have text in a numeric array.&lt;br&gt;
&lt;br&gt;
The closest you can get is the approach the other poster&lt;br&gt;
suggested, which is to use a cell array -- or you could&lt;br&gt;
use a structure which had a field for the numerics and&lt;br&gt;
another field for the text. But neither cell arrays&lt;br&gt;
nor structures will display &quot;nicely&quot; as columns of numbers&lt;br&gt;
intermixed with columns of text.</description>
    </item>
    <item>
      <pubDate>Wed, 17 Sep 2008 23:34:02 -0400</pubDate>
      <title>Re: Adding Text columns to a Matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236139#600778</link>
      <author>Raju Gain</author>
      <description>Thanks everyone..&lt;br&gt;
Got it working..&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Walter Roberson&quot; &amp;lt;roberson@ibd.nrc-cnrc.gc.ca&amp;gt; wrote in message &amp;lt;garkd2$ifv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Raju Gain&quot; &amp;lt;supernova5271@yahoo.com&amp;gt; wrote in message &amp;lt;garivv$sni$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I have created a variable A = zeros(5,5). The first three &lt;br&gt;
&amp;gt; &amp;gt; columns contain double values. I have another variable &lt;br&gt;
&amp;gt; &amp;gt; which contains strings for example 'Yes' or 'No'. I am&lt;br&gt;
&amp;gt; &amp;gt; trying to add this variable to A(:,4)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You cannot mix data classes in a single array. You cannot&lt;br&gt;
&amp;gt; have text in a numeric array.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The closest you can get is the approach the other poster&lt;br&gt;
&amp;gt; suggested, which is to use a cell array -- or you could&lt;br&gt;
&amp;gt; use a structure which had a field for the numerics and&lt;br&gt;
&amp;gt; another field for the text. But neither cell arrays&lt;br&gt;
&amp;gt; nor structures will display &quot;nicely&quot; as columns of numbers&lt;br&gt;
&amp;gt; intermixed with columns of text.</description>
    </item>
  </channel>
</rss>

