<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799</link>
    <title>MATLAB Central Newsreader - COV broken for vectors in r2011a</title>
    <description>Feed for thread: COV broken for vectors in r2011a</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 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.nl/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 26 Sep 2011 09:42:13 +0000</pubDate>
      <title>COV broken for vectors in r2011a</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799#853336</link>
      <author>Richard Crozier</author>
      <description>My department has just upgraded to r2011a&lt;br&gt;
&lt;br&gt;
The cov function is supposed to take a vector and return the variance of the vector, but cov now contains this test at the start:&lt;br&gt;
&lt;br&gt;
if ~ismatrix(x)&lt;br&gt;
&amp;nbsp;&amp;nbsp;error(message('MATLAB:cov:InputDim')); &lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
This means vectors are always rejected. Aren't functions tested before deployment, or am I missing something here?&lt;br&gt;
&lt;br&gt;
Consider the following in r2008a&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2.5000&lt;br&gt;
&lt;br&gt;
But in r2011a:&lt;br&gt;
&lt;br&gt;
K&amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
K&amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
??? Error using ==&amp;gt; cov at 37&lt;br&gt;
Inputs must be 2-D.</description>
    </item>
    <item>
      <pubDate>Mon, 26 Sep 2011 10:15:15 +0000</pubDate>
      <title>Re: COV broken for vectors in r2011a</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799#853339</link>
      <author>Wayne King</author>
      <description>"Richard Crozier" wrote in message &amp;lt;j5phdl$44a$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; My department has just upgraded to r2011a&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The cov function is supposed to take a vector and return the variance of the vector, but cov now contains this test at the start:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if ~ismatrix(x)&lt;br&gt;
&amp;gt;   error(message('MATLAB:cov:InputDim')); &lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This means vectors are always rejected. Aren't functions tested before deployment, or am I missing something here?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Consider the following in r2008a&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     2.5000&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But in r2011a:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; K&amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; K&amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; cov at 37&lt;br&gt;
&amp;gt; Inputs must be 2-D.&lt;br&gt;
&lt;br&gt;
Hi Richard, I don't have any problem with this in R2011a&lt;br&gt;
indepvar =[1,2,3,4,5];&lt;br&gt;
ismatrix(indepvar)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;br&gt;
&lt;br&gt;
size(indepvar)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1     5&lt;br&gt;
&lt;br&gt;
cov(indepvar)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2.5000&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I suspect your installation has a non-Mathworks' version of ismatrix(). The Mathworks' version of ismatrix() returns a 1 for row and column vectors. If size() returns a row vector with nonnegative integers, then ismatrix() (the Mathworks' ismatrix()) is 1. &lt;br&gt;
&lt;br&gt;
If you enter:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt;which ismatrix&lt;br&gt;
&lt;br&gt;
Do you get something like this:&lt;br&gt;
built-in (/mathworks...toolbox/matlab/elmat/ismatrix)&lt;br&gt;
&lt;br&gt;
Wayne</description>
    </item>
    <item>
      <pubDate>Mon, 26 Sep 2011 10:25:13 +0000</pubDate>
      <title>Re: COV broken for vectors in r2011a</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799#853341</link>
      <author>Richard Crozier</author>
      <description>"Wayne King" wrote in message &amp;lt;j5pjbj$a0o$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Richard Crozier" wrote in message &amp;lt;j5phdl$44a$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; My department has just upgraded to r2011a&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; The cov function is supposed to take a vector and return the variance of the vector, but cov now contains this test at the start:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; if ~ismatrix(x)&lt;br&gt;
&amp;gt; &amp;gt;   error(message('MATLAB:cov:InputDim')); &lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; This means vectors are always rejected. Aren't functions tested before deployment, or am I missing something here?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Consider the following in r2008a&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;     2.5000&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; But in r2011a:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; K&amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt; K&amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using ==&amp;gt; cov at 37&lt;br&gt;
&amp;gt; &amp;gt; Inputs must be 2-D.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Richard, I don't have any problem with this in R2011a&lt;br&gt;
&amp;gt; indepvar =[1,2,3,4,5];&lt;br&gt;
&amp;gt; ismatrix(indepvar)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;      1&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; size(indepvar)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;      1     5&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     2.5000&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I suspect your installation has a non-Mathworks' version of ismatrix(). The Mathworks' version of ismatrix() returns a 1 for row and column vectors. If size() returns a row vector with nonnegative integers, then ismatrix() (the Mathworks' ismatrix()) is 1. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you enter:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;which ismatrix&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Do you get something like this:&lt;br&gt;
&amp;gt; built-in (/mathworks...toolbox/matlab/elmat/ismatrix)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Wayne&lt;br&gt;
&lt;br&gt;
Ahh, you're right, there is a version of ismatrix on the system, I didn't know TMW had introduced this. I would have though ismatrix would return false for vectors though.</description>
    </item>
    <item>
      <pubDate>Mon, 26 Sep 2011 10:41:13 +0000</pubDate>
      <title>Re: COV broken for vectors in r2011a</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799#853343</link>
      <author>Wayne King</author>
      <description>"Richard Crozier" wrote in message &amp;lt;j5pju9$bv1$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Wayne King" wrote in message &amp;lt;j5pjbj$a0o$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; "Richard Crozier" wrote in message &amp;lt;j5phdl$44a$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; My department has just upgraded to r2011a&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The cov function is supposed to take a vector and return the variance of the vector, but cov now contains this test at the start:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; if ~ismatrix(x)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;   error(message('MATLAB:cov:InputDim')); &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; This means vectors are always rejected. Aren't functions tested before deployment, or am I missing something here?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Consider the following in r2008a&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;     2.5000&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; But in r2011a:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; K&amp;gt;&amp;gt; indepvar = [1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; K&amp;gt;&amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ??? Error using ==&amp;gt; cov at 37&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Inputs must be 2-D.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hi Richard, I don't have any problem with this in R2011a&lt;br&gt;
&amp;gt; &amp;gt; indepvar =[1,2,3,4,5];&lt;br&gt;
&amp;gt; &amp;gt; ismatrix(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;      1&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; size(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;      1     5&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; cov(indepvar)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ans =&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;     2.5000&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I suspect your installation has a non-Mathworks' version of ismatrix(). The Mathworks' version of ismatrix() returns a 1 for row and column vectors. If size() returns a row vector with nonnegative integers, then ismatrix() (the Mathworks' ismatrix()) is 1. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; If you enter:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt;which ismatrix&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Do you get something like this:&lt;br&gt;
&amp;gt; &amp;gt; built-in (/mathworks...toolbox/matlab/elmat/ismatrix)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Wayne&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Ahh, you're right, there is a version of ismatrix on the system, I didn't know TMW had introduced this. I would have though ismatrix would return false for vectors though.&lt;br&gt;
&lt;br&gt;
Hi Richard, ismatrix() was introduced in R2010b along with isrow() and iscolumn() that you can use for row or column vectors.&lt;br&gt;
&lt;br&gt;
Hope that helps,&lt;br&gt;
Wayne</description>
    </item>
    <item>
      <pubDate>Mon, 26 Sep 2011 13:14:01 +0000</pubDate>
      <title>Re: COV broken for vectors in r2011a</title>
      <link>http://www.mathworks.nl/matlabcentral/newsreader/view_thread/312799#853350</link>
      <author>Steven_Lord</author>
      <description>&lt;br&gt;
&lt;br&gt;
"Richard Crozier" &amp;lt;r.crozier@ed.ac.uk&amp;gt; wrote in message &lt;br&gt;
news:j5pju9$bv1$1@newscl01ah.mathworks.com...&lt;br&gt;
&amp;gt; "Wayne King" wrote in message &amp;lt;j5pjbj$a0o$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; "Richard Crozier" wrote in message &lt;br&gt;
&amp;gt;&amp;gt; &amp;lt;j5phdl$44a$1@newscl01ah.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; Ahh, you're right, there is a version of ismatrix on the system, I didn't &lt;br&gt;
&amp;gt; know TMW had introduced this. I would have though ismatrix would return &lt;br&gt;
&amp;gt; false for vectors though.&lt;br&gt;
&lt;br&gt;
As Wayne said these were introduced in release R2010b:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/help/techdoc/rn/bsk8h3i-1.html"&gt;http://www.mathworks.com/help/techdoc/rn/bsk8h3i-1.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
I recommend that when you upgrade your version of MATLAB that you spend a &lt;br&gt;
few minutes reviewing the Release Notes. We try to make sure that most or &lt;br&gt;
all of the major changes to each product are mentioned there. The Release &lt;br&gt;
Notes for releases back to R14 (which was released about seven years ago) &lt;br&gt;
are available online; I believe there are also in the documentation included &lt;br&gt;
in your installation.&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.mathworks.com/help/techdoc/rn/rn_intro.html"&gt;http://www.mathworks.com/help/techdoc/rn/rn_intro.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Looking specifically at ISMATRIX, these are the rules that the IS&amp;lt;array &lt;br&gt;
shape&amp;gt; functions follow.&lt;br&gt;
&lt;br&gt;
ISSCALAR returns true if calling SIZE on the input returns [1 1].&lt;br&gt;
ISVECTOR returns true if calling SIZE on the input returns [1 n] or [n 1] &lt;br&gt;
for nonnegative scalar n.&lt;br&gt;
ISMATRIX returns true if calling SIZE on the input returns [m n] where m and &lt;br&gt;
n are nonnegative scalars.&lt;br&gt;
ISROW returns true if calling SIZE on the input returns [1 n] for &lt;br&gt;
nonnegative scalar n.&lt;br&gt;
ISCOLUMN returns true if calling SIZE on the input returns [n 1] for &lt;br&gt;
nonnegative scalar n.&lt;br&gt;
&lt;br&gt;
In particular, if x is a 1-by-1 array then all of isscalar(x), isvector(x) &lt;br&gt;
[n = 1], ismatrix(x) [m, n = 1], isrow(x) [n = 1], and iscolumn(x) [n = 1] &lt;br&gt;
are true. Since the SIZE of a vector is [1 n] or [n 1] it satisfies the &lt;br&gt;
requirement for ISMATRIX.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
To contact Technical Support use the Contact Us link on &lt;br&gt;
&lt;a href="http://www.mathworks.com"&gt;http://www.mathworks.com&lt;/a&gt; </description>
    </item>
  </channel>
</rss>
