<?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: Average the nonzero elements in a vector in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519578#M246780</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;I was wondering what a "double vector" could possibly be. You're right, probably a "1D array of DBL" &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt;</description>
    <pubDate>Thu, 10 May 2007 16:52:36 GMT</pubDate>
    <dc:creator>altenbach</dc:creator>
    <dc:date>2007-05-10T16:52:36Z</dc:date>
    <item>
      <title>Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519537#M246761</link>
      <description>I have a double vector with 137 elements. The top and bottom of the vector are zero-filled. However, the number of useful data points and the size of the zero-filled range varies each time I look at the vector. I know how to use the mean function, but how can I remove all zeros in my vector prior to that?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 May 2007 15:45:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519537#M246761</guid>
      <dc:creator>CrAyZ</dc:creator>
      <dc:date>2007-05-10T15:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519545#M246764</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;If you simply want to exclude &lt;STRONG&gt;all nonzero elements&lt;/STRONG&gt;, you can do something simple as in this image.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;IMG src="http://forums.ni.com/attachments/ni/170/246764/1/Mean-Nonzero.png" /&gt;&lt;/DIV&gt;
&lt;DIV&gt;(Sum all elements and divide by the number of nonzero elements)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;If you only want to exclude the initial and final stretch of zeroes, but retain possible zeroes in the middle, things get very&amp;nbsp;slighly more complex. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by altenbach on &lt;SPAN class="date_text"&gt;05-10-2007&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:59 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2007 15:58:02 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519545#M246764</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2007-05-10T15:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519566#M246775</link>
      <description>Also, if your array is not an integer data type, you may need to use the In Range and Coerce function rather than Not Equal to Zero.  Comparisons of floating point numbers to zero need to be approached cautiously because of finite representation of numbers in the computer.</description>
      <pubDate>Thu, 10 May 2007 16:35:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519566#M246775</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2007-05-10T16:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519578#M246780</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;I was wondering what a "double vector" could possibly be. You're right, probably a "1D array of DBL" &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt;</description>
      <pubDate>Thu, 10 May 2007 16:52:36 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519578#M246780</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2007-05-10T16:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519904#M246903</link>
      <description>You could do it in this way.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 May 2007 08:07:36 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/519904#M246903</guid>
      <dc:creator>NorbertJ</dc:creator>
      <dc:date>2007-05-11T08:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/520148#M246989</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Norbert, it does not really make a lot of sense to built an array if all you need is the sum of the element at the end. You could just keep the current sum in a shift register (see top of image). Also "array subset" is the right tool to take a subset, "split array" is overkill if you only need one of the outputs. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Here are a few more&amp;nbsp;variations to exclude elements close to zero. In the bottom code it only strips the head and tail, but averages all elements between the first and last zero element.&lt;/DIV&gt;
&lt;DIV&gt;&lt;IMG src="http://forums.ni.com/attachments/ni/170/246989/2/SelectiveMean.png" /&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by altenbach on &lt;SPAN class="date_text"&gt;05-11-2007&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:27 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 May 2007 15:27:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/520148#M246989</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2007-05-11T15:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/521727#M247570</link>
      <description>Any idea why my VI, which uses OPC to pull in an array of data, crashes LabVIEW when I hit the stop button? My paths are OK, since it works once in a while and has worked before. However, every time I want to stop execution and go to the block diagram, I crash labVIEW and sometimes Windows. Any and all suggestions are appreciated.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 May 2007 18:35:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/521727#M247570</guid>
      <dc:creator>CrAyZ</dc:creator>
      <dc:date>2007-05-15T18:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/521776#M247589</link>
      <description>&lt;DIV&gt;Well, this probably has nothing to do with the code above. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;A crash should never happen in normal use, so someting is unexpected. Are you using some third-party DLL, for example?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Are you stopping with the stop button in the toolbar or with a boolean control on the front panel?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Other intersting information would be: Your OS, LabVIEW version, etc.&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 May 2007 20:26:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/521776#M247589</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2007-05-15T20:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average the nonzero elements in a vector</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/536486#M253188</link>
      <description>Think you could help with my newest &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=253157" target="_blank"&gt;post&lt;/A&gt;?&lt;BR /&gt;&lt;BR /&gt;I have to find the maximum value of certain ranges of array elements. Also trying to come up with a report that I can print.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 14 Jun 2007 17:30:57 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Average-the-nonzero-elements-in-a-vector/m-p/536486#M253188</guid>
      <dc:creator>CrAyZ</dc:creator>
      <dc:date>2007-06-14T17:30:57Z</dc:date>
    </item>
  </channel>
</rss>

