<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238312</link>
    <title>MATLAB Central Newsreader - isfinite to find max w/o including Inf</title>
    <description>Feed for thread: isfinite to find max w/o including Inf</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, 28 Oct 2008 17:42:02 -0400</pubDate>
      <title>isfinite to find max w/o including Inf</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238312#607758</link>
      <author>Diego Zegarra</author>
      <description>Could someone please tell me whats wrong with my code?&lt;br&gt;
&lt;br&gt;
h = MTT{m}(MSchJ{m}(end),:);&lt;br&gt;
MAXP = [MAXP; max(h(isfinite(MTT{m}(MSchJ{m}(end),:)),1))];&lt;br&gt;
&lt;br&gt;
This is the error I get:&lt;br&gt;
&lt;br&gt;
??? Index exceeds matrix dimensions.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; SAPSLMETARAPS at 197&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;MAXP = [MAXP; max(h(isfinite(MTT{m}(MSchJ{m}(end),:)),1))];&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Diego</description>
    </item>
    <item>
      <pubDate>Tue, 28 Oct 2008 21:33:01 -0400</pubDate>
      <title>Re: isfinite to find max w/o including Inf</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238312#607788</link>
      <author>Walter Roberson</author>
      <description>&quot;Diego Zegarra&quot; &amp;lt;diegozbb@gmail.com&amp;gt; wrote in message &amp;lt;ge7ita$jdd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Could someone please tell me whats wrong with my code?&lt;br&gt;
&lt;br&gt;
&amp;gt; h = MTT{m}(MSchJ{m}(end),:);&lt;br&gt;
&amp;gt; MAXP = [MAXP; max(h(isfinite(MTT{m}(MSchJ{m}(end),:)),1))];&lt;br&gt;
&lt;br&gt;
That is equivalent to&lt;br&gt;
&lt;br&gt;
MAXP = [MAXP; max(h(isfinite(h),1))];&lt;br&gt;
&lt;br&gt;
Did you perhaps mean&lt;br&gt;
&lt;br&gt;
MAXP = [MAXP; max(h(isfinite(h)),1)];&lt;br&gt;
&lt;br&gt;
that is, taking the maximum along the first dimension&lt;br&gt;
rather than access the first column of h?&lt;br&gt;
&lt;br&gt;
We can see from the definition of h that is expected&lt;br&gt;
to be exactly one entire row, so it is going to be 1 x something.&lt;br&gt;
isfinite(h) would be the same size, 1 x something.&lt;br&gt;
You then use that 1 x something logical array as the -first-&lt;br&gt;
index of h rather than as the -second- index of h,  as if you&lt;br&gt;
were attempting to access a something x 1 array. And since it&lt;br&gt;
doesn't have all those rows and you explicitly specified the&lt;br&gt;
second dimension it knows that you aren't just using logical&lt;br&gt;
indexing relative to the beginning of the array... so it bombs out.</description>
    </item>
  </channel>
</rss>

