<?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: Getting data out of For Loop in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6865#M5347</link>
    <description>Thank you Craig, I will try this first solution, not using the for loop in the&lt;BR /&gt;subVI. And maybe for trying the others.&lt;BR /&gt;&lt;BR /&gt;Willem-Jan &lt;BR /&gt;</description>
    <pubDate>Wed, 22 Nov 2000 10:34:51 GMT</pubDate>
    <dc:creator>Willem-Jan Vreeling</dc:creator>
    <dc:date>2000-11-22T10:34:51Z</dc:date>
    <item>
      <title>Getting data out of For Loop</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6863#M5345</link>
      <description>In an application for measuring the resistance of several samples, I&lt;BR /&gt;have problems reading the data out of a For Loop. The samples are heated&lt;BR /&gt;up and after each temperature step, the resistances are measured. So in&lt;BR /&gt;each step of the loop I increase the temperature and read out the&lt;BR /&gt;resistances. At the end I get an array of the data.&lt;BR /&gt;&lt;BR /&gt;However, it would be better if I could also follow the measurement&lt;BR /&gt;realtime. So I put the digital indicator in the same for loop. This&lt;BR /&gt;seemed to work. The problem arised when I used this VI as SubVI in the&lt;BR /&gt;main program. Now I can only read the complete array at the end of&lt;BR /&gt;measurement.&lt;BR /&gt;How can I solve this problem and read out the data realtime in the main&lt;BR /&gt;program?&lt;BR /&gt;&lt;BR /&gt;Thanks for any help!&lt;BR /&gt;&lt;BR /&gt;Willem-Jan &lt;BR /&gt;</description>
      <pubDate>Wed, 22 Nov 2000 09:10:47 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6863#M5345</guid>
      <dc:creator>Willem-Jan Vreeling</dc:creator>
      <dc:date>2000-11-22T09:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data out of For Loop</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6864#M5346</link>
      <description>Willem-Jan Vreeling &lt;W.J.VREELING&gt; wrote in message&lt;BR /&gt;news:3A1B8D97.695C9C50@sron.rug.nl...&lt;BR /&gt;&amp;gt; In an application for measuring the resistance of several samples, I&lt;BR /&gt;&amp;gt; have problems reading the data out of a For Loop. The samples are heated&lt;BR /&gt;&amp;gt; up and after each temperature step, the resistances are measured. So in&lt;BR /&gt;&amp;gt; each step of the loop I increase the temperature and read out the&lt;BR /&gt;&amp;gt; resistances. At the end I get an array of the data.&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt; However, it would be better if I could also follow the measurement&lt;BR /&gt;&amp;gt; realtime. So I put the digital indicator in the same for loop. This&lt;BR /&gt;&amp;gt; seemed to work. The problem arised when I used this VI as SubVI in the&lt;BR /&gt;&amp;gt; main program. Now I can only read the complete array at the end of&lt;BR /&gt;&amp;gt; measurement.&lt;BR /&gt;&amp;gt; How can I solve this problem and read out the data realtime in the main&lt;BR /&gt;&amp;gt; program?&lt;BR /&gt;&lt;BR /&gt;First consider not using the for loop in the sub-VI, but instead have the&lt;BR /&gt;subVI go to a single temperature, passed to it as an argument, and return a&lt;BR /&gt;single set of resistance values. This is far simpler to handle and to debug.&lt;BR /&gt;&lt;BR /&gt;If you MUST have a sub-VI that is called and then runs the entire&lt;BR /&gt;experiment, periodically reporting back to the calling VI, there are three&lt;BR /&gt;common ways in which the communication can take place. In order of personal&lt;BR /&gt;preference,&lt;BR /&gt;&lt;BR /&gt;1) Queues. The calling VI creates a queue, the reference of which is passed&lt;BR /&gt;to the sub-VI (or the sub-VI simply opens the reference itself each time&lt;BR /&gt;it's needed). The sub-VI puts the data in the queue as it is ready, and the&lt;BR /&gt;calling VI periodically polls the queue to retrieve any pending data.&lt;BR /&gt;&lt;BR /&gt;2) VI server. The sub-VI can open a reference to controls on the front panel&lt;BR /&gt;of the calling VI and can itself directly read and write these&lt;BR /&gt;controls/indicators. This can become difficult to debug because there is no&lt;BR /&gt;way you can start at the control and trace wires back to see where the data&lt;BR /&gt;is coming from, for debugging purposes.&lt;BR /&gt;&lt;BR /&gt;3) Globals. The subVI writes the data to a global variable, and sets a&lt;BR /&gt;global Boolean "true" to indicate the presence of data. The calling VI&lt;BR /&gt;checks the Boolean at a faster rate than the data can arrive, if the Boolean&lt;BR /&gt;is true it reads the data from the global and sets the Boolean back to&lt;BR /&gt;false. This is the "old" way but is pretty crap in comparison to the queue&lt;BR /&gt;method.&lt;BR /&gt;&lt;BR /&gt;In cases 1 and 3 you must make sure the calling VI continues to run while&lt;BR /&gt;the sub-VI is running. This means putting the call to the sub-VI in an&lt;BR /&gt;independent loop from the main program code, and some thought should be&lt;BR /&gt;given to interloop communication.  Remember that if you have a sub-VI call&lt;BR /&gt;within a structure- a loop, sequence etc- that structure will not complete&lt;BR /&gt;until all sub-VI calls within it have completed.&lt;BR /&gt;&lt;/W.J.VREELING&gt;</description>
      <pubDate>Wed, 22 Nov 2000 11:07:38 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6864#M5346</guid>
      <dc:creator>CraigGraham</dc:creator>
      <dc:date>2000-11-22T11:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting data out of For Loop</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6865#M5347</link>
      <description>Thank you Craig, I will try this first solution, not using the for loop in the&lt;BR /&gt;subVI. And maybe for trying the others.&lt;BR /&gt;&lt;BR /&gt;Willem-Jan &lt;BR /&gt;</description>
      <pubDate>Wed, 22 Nov 2000 10:34:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Getting-data-out-of-For-Loop/m-p/6865#M5347</guid>
      <dc:creator>Willem-Jan Vreeling</dc:creator>
      <dc:date>2000-11-22T10:34:51Z</dc:date>
    </item>
  </channel>
</rss>

