<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263290</link>
    <title>MATLAB Central Newsreader - Empty array gets added to. (Or not)</title>
    <description>Feed for thread: Empty array gets added to. (Or not)</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>Fri, 16 Oct 2009 09:56:03 -0400</pubDate>
      <title>Empty array gets added to. (Or not)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263290#687497</link>
      <author>Andr? </author>
      <description>Hi.&lt;br&gt;
&lt;br&gt;
I discovered that &lt;br&gt;
&lt;br&gt;
a=[];&lt;br&gt;
b=4;&lt;br&gt;
a=a+b;&lt;br&gt;
&lt;br&gt;
will not yield an error message as would&lt;br&gt;
&lt;br&gt;
a = a+4;&lt;br&gt;
&lt;br&gt;
(without first assigning a). Yet it also does not give a=4... I knew that Nan+4 =NaN, but why is []+4=[] ? Is there more 'black hole beahviour' i should know about?&lt;br&gt;
&lt;br&gt;
Thank you.&lt;br&gt;
&lt;br&gt;
Andr</description>
    </item>
    <item>
      <pubDate>Fri, 16 Oct 2009 12:05:29 -0400</pubDate>
      <title>Re: Empty array gets added to. (Or not)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263290#687525</link>
      <author>Loren Shure</author>
      <description>In article &amp;lt;hb9fvj$i37$1@fred.mathworks.com&amp;gt;, bukwyrm@googlemail.com &lt;br&gt;
says...&lt;br&gt;
&amp;gt; Hi.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I discovered that &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; a=[];&lt;br&gt;
&amp;gt; b=4;&lt;br&gt;
&amp;gt; a=a+b;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; will not yield an error message as would&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; a = a+4;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; (without first assigning a). Yet it also does not give a=4... I knew that Nan+4 =NaN, but why is []+4=[] ? Is there more 'black hole beahviour' i should know about?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Andr&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
b is a scalar and MATLAB addition adheres to the scalar expansion rule, &lt;br&gt;
i.e., anything + scalar is size of anything.  Hence you get empty as the &lt;br&gt;
output for a in your example.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Loren&lt;br&gt;
&lt;a href=&quot;http://blogs.mathworks.com/loren&quot;&gt;http://blogs.mathworks.com/loren&lt;/a&gt;</description>
    </item>
  </channel>
</rss>

