<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254664</link>
    <title>MATLAB Central Newsreader - even values</title>
    <description>Feed for thread: even values</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>Thu, 25 Jun 2009 16:08:02 -0400</pubDate>
      <title>even values</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254664#660458</link>
      <author>remi </author>
      <description>Hello all,...Please if i have a matix and i want to find out the amount of even coefficients it contains..&lt;br&gt;
ie&lt;br&gt;
B= [1 4 8 0 9 5&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7 2 6 1 2 4&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9 2 0 3 0 6]&lt;br&gt;
i want to be able to count out that there are 8 even values of of the 18 values.&lt;br&gt;
Thanks</description>
    </item>
    <item>
      <pubDate>Thu, 25 Jun 2009 16:13:01 -0400</pubDate>
      <title>Re: even values</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254664#660461</link>
      <author>us</author>
      <description>&quot;remi &quot; &amp;lt;obiosiki@yahoo.com&amp;gt; wrote in message &amp;lt;h207d1$ml6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello all,...Please if i have a matix and i want to find out the amount of even coefficients it contains..&lt;br&gt;
&amp;gt; ie&lt;br&gt;
&amp;gt; B= [1 4 8 0 9 5&lt;br&gt;
&amp;gt;        7 2 6 1 2 4&lt;br&gt;
&amp;gt;        9 2 0 3 0 6]&lt;br&gt;
&amp;gt; i want to be able to count out that there are 8 even values of of the 18 values.&lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&lt;br&gt;
this FEX submission may be helpful...&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24278&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/24278&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Thu, 25 Jun 2009 16:18:10 -0400</pubDate>
      <title>Re: even values</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254664#660462</link>
      <author>Nathan</author>
      <description>On Jun 25, 9:08&#160;am, &quot;remi &quot; &amp;lt;obios...@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hello all,...Please if i have a matix and i want to find out the amount of even coefficients it contains..&lt;br&gt;
&amp;gt; ie&lt;br&gt;
&amp;gt; B= [1 4 8 0 9 5&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160;7 2 6 1 2 4&lt;br&gt;
&amp;gt; &#160; &#160; &#160; &#160;9 2 0 3 0 6]&lt;br&gt;
&amp;gt; i want to be able to count out that there are 8 even values of of the 18 values.&lt;br&gt;
&amp;gt; Thanks&lt;br&gt;
&lt;br&gt;
You do know that Zero is an even number, right?&lt;br&gt;
Therefore.. that would be 11 even values...&lt;br&gt;
%total elements minus odd elements&lt;br&gt;
B = numel(B) - numel(find(mod(B,2)));&lt;br&gt;
&lt;br&gt;
B will be the number of even elements.&lt;br&gt;
&lt;br&gt;
Hope that's what you were looking for.&lt;br&gt;
&lt;br&gt;
However, if you want Zero to not be counted, just set the zero values&lt;br&gt;
to an odd number first:&lt;br&gt;
B(find(B==0)) = 1;&lt;br&gt;
and THEN do:&lt;br&gt;
B = numel(B) - numel(find(mod(B,2)));&lt;br&gt;
&lt;br&gt;
-Nathan</description>
    </item>
  </channel>
</rss>

