<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Array Issues Breaking For Loop in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614172#M186144</link>
    <description>&lt;P&gt;Obviously the calculated vector contains not the same values as the manually typed in. As we don't see what f.aq and t.MA are and how those values are derived we cannnot tell where the difference is. It might be some decimals because of round off errors it might even be that the calculated vector contains non-real values with a very tiny imaginary part. Without seeing the sheet we cannot tell.&lt;/P&gt;
&lt;P&gt;Furthermore you &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;do not even reveal what the error message says! Obviously the call to movavg() fails and if the second argument is not a true integer, this function must fail.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;So check the calculated vector if the values are true integers by showing more decimals and apply the "round" function where necessary.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;A workaround can be to use&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;n.pts &amp;lt;-- round(n.filter[i)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;in your function instead of just&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT face="courier new,courier"&gt;n.pts &amp;lt;-- n.filter[i&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 16:48:57 GMT</pubDate>
    <dc:creator>Werner_E</dc:creator>
    <dc:date>2019-06-14T16:48:57Z</dc:date>
    <item>
      <title>Array Issues Breaking For Loop</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614157#M186141</link>
      <description>&lt;P&gt;After much hair-pulling and manual debugging, I cannot resolve an issue that is breaking a calculation in my for loop. I have imported a dataset that I want to apply various moving average filters to and output a statistical value on the data (mean, stdev, etc...) &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;My issue is that identical arrays are either working or breaking my loop.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I specify a manual vector of points, the calculation works. If I have a for loop to create an array of time for my moving average filter based on number of filters and max filter time (s), and multiply by frequency (Hz), I get what seems to be an identical vector. One (the manual) is working, and one (the loop generated) fails, even though the look identical.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Image shown below.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Left side, manual "n_filter" enabled and automatically generated "n_filter" disabled.&lt;/P&gt;
&lt;P&gt;Right side,&amp;nbsp;manual "n_filter" disabled and automatically generated "n_filter" enabled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="For Loop.png" style="width: 999px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/17098i88D18F28FD64119F/image-size/large?v=v2&amp;amp;px=999" role="button" title="For Loop.png" alt="For Loop.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:04:07 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614157#M186141</guid>
      <dc:creator>Theo_Gagner</dc:creator>
      <dc:date>2019-06-14T15:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Array Issues Breaking For Loop</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614165#M186143</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You should attach the complete file, or only the affected section. Otherwise what can we do? rewrite the program?!?!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:44:27 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614165#M186143</guid>
      <dc:creator>-MFra-</dc:creator>
      <dc:date>2019-06-14T15:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Array Issues Breaking For Loop</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614172#M186144</link>
      <description>&lt;P&gt;Obviously the calculated vector contains not the same values as the manually typed in. As we don't see what f.aq and t.MA are and how those values are derived we cannnot tell where the difference is. It might be some decimals because of round off errors it might even be that the calculated vector contains non-real values with a very tiny imaginary part. Without seeing the sheet we cannot tell.&lt;/P&gt;
&lt;P&gt;Furthermore you &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;do not even reveal what the error message says! Obviously the call to movavg() fails and if the second argument is not a true integer, this function must fail.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;So check the calculated vector if the values are true integers by showing more decimals and apply the "round" function where necessary.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;A workaround can be to use&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;n.pts &amp;lt;-- round(n.filter[i)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;in your function instead of just&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT face="courier new,courier"&gt;n.pts &amp;lt;-- n.filter[i&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 16:48:57 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614172#M186144</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2019-06-14T16:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Array Issues Breaking For Loop</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614175#M186145</link>
      <description>&lt;P&gt;That you Werner! Sometimes you can't see the forest for the trees.&lt;/P&gt;
&lt;P&gt;I had checked the value of f_aq to some decimal places, but not enough. On the 9th decimal place the f_aq comes off of a whole number value and causes the calculation to fail. Looks like the workaround is necessary. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 17:05:44 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614175#M186145</guid>
      <dc:creator>Theo_Gagner</dc:creator>
      <dc:date>2019-06-14T17:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Array Issues Breaking For Loop</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614177#M186146</link>
      <description>&lt;P&gt;Just looking for someone to point out the obvious. Werner picked up on it right away.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 17:06:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Array-Issues-Breaking-For-Loop/m-p/614177#M186146</guid>
      <dc:creator>Theo_Gagner</dc:creator>
      <dc:date>2019-06-14T17:06:22Z</dc:date>
    </item>
  </channel>
</rss>

