<?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: for loop array issue in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2603025#M781663</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/278563"&gt;@kulsman&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Even if I read in the file outside of the for loop. I was not able to find a way for labview to iterate by two.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;something like this;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for(int 1=0; i&amp;lt;5000; i+=2)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You please pay attention.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Oct 2013 10:48:09 GMT</pubDate>
    <dc:creator>Ranjeet_Singh</dc:creator>
    <dc:date>2013-10-26T10:48:09Z</dc:date>
    <item>
      <title>for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602919#M781621</link>
      <description>&lt;P&gt;I am really new to programing in labview (started on Monday). I have been following the labview toturials online and in NI website, but I not been able to solve it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: all of the values in the array are the same.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps, someone here can take look at it.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 05:48:25 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602919#M781621</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T05:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602921#M781622</link>
      <description>&lt;P&gt;What you want to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you have tried so far? Upload in 2011&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 05:58:32 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602921#M781622</guid>
      <dc:creator>Ranjeet_Singh</dc:creator>
      <dc:date>2013-10-26T05:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602923#M781623</link>
      <description>&lt;P&gt;I just to store all the calculated values in the for loop into the array. Please look at the picture attached above&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:01:27 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602923#M781623</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T06:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602925#M781624</link>
      <description>&lt;P&gt;Like I said update yours as its not clear here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See my attached VI, I am calculating and adding all the calculated value at last&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:08:53 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602925#M781624</guid>
      <dc:creator>Ranjeet_Singh</dc:creator>
      <dc:date>2013-10-26T06:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602927#M781625</link>
      <description>&lt;P&gt;Nope.....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;still not clear what are you asking&lt;/P&gt;
&lt;P&gt;do you want some values after For loop in an array and you are not getting it???????&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:09:04 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602927#M781625</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T06:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602929#M781626</link>
      <description>&lt;P&gt;The vi has lots of sub vi,so I am not sure how to post them all.&amp;nbsp; I have attached picture of the array values&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:12:55 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602929#M781626</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T06:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602931#M781627</link>
      <description>&lt;P&gt;You can explain the problem what output you are expecting ( and why , where )&lt;/P&gt;
&lt;P&gt;and what you are getting&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:16:13 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602931#M781627</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T06:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602935#M781628</link>
      <description>&lt;P&gt;For instance, I run the for loop 4 time:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if I get a value of [2, 5] at the last iteration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My current array looks like this [2,5,2,5,2,5,2,5], when it should be like this [3,9,5,1,4,3,2,5]&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:22:27 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602935#M781628</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T06:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602939#M781629</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Ok .........&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Look at the build array function , you are giving it two values at a time. So it is creating an array of say ( 3, 1)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;every iteration your are creating a new array .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So to get full array at output you need to put your tunnel mode as indexing then you will get a 2D array containing all elements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lot of explanation beacuse you just started learning LabVIEW.&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.ni.com/i/smilies/16x16_smiley-very-happy.gif" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:31:29 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602939#M781629</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T06:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602943#M781631</link>
      <description>&lt;P&gt;Nope, it still does not work. Now I getting a 2-d array like this...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[2,5]&lt;/P&gt;
&lt;P&gt;[2,5]&lt;/P&gt;
&lt;P&gt;[2,5]&lt;/P&gt;
&lt;P&gt;[2,5]&lt;/P&gt;
&lt;P&gt;[2,5]&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:35:22 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602943#M781631</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T06:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602947#M781633</link>
      <description>&lt;P&gt;Now it means everytime the Data you are getting is the same.&lt;/P&gt;
&lt;P&gt;its not the problem of For loop , but your algorithm&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what you are trying to do ??????&lt;/P&gt;
&lt;P&gt;You can check your 'encrypt XETA' subvi why everytime the values generated are same ( unless you are not expecting the same values )&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:41:05 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602947#M781633</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T06:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602949#M781634</link>
      <description>&lt;P&gt;It is not the encrypt vi. already used shift registers to check. I am getting the previous value.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:48:03 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602949#M781634</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T06:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602951#M781635</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/278563"&gt;@kulsman&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am really new to programing in labview (started on Monday). I have been following the labview toturials online and in NI website, but I not been able to solve it.&lt;/P&gt;
&lt;P&gt;Edit: all of the values in the array are the same.....&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.ni.com/ni/attachments/ni/170/781621/1/buildarray.PNG" border="0" alt="" title="" align="center" /&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Of course all your values are the same, because you are always reading the &lt;U&gt;same file&lt;/U&gt; (that operation probably belongs before the loop because the outcome will not change between iterations!) and are indexing out the &lt;U&gt;same elements&lt;/U&gt;&amp;nbsp;(with indices 2 and 3). Note that you are wiring from the inside of N, which simply returns "2" in your case, irrespective of the iteration number. If you want to index out locations that depend on the iteration number, you need to tap into the [i] terminal, not "N".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, note that "index array" is resizeable, so you only need one instance to get two elements. Simplify!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is really impossible to debug your code from a picture, because there is simply not enough information. For example what is the datatype of the blue diagram constant wire to the file read? What is in the other case of the case structure, and what value is the boolean when you run the program? Why is Key(HEX) inside the loop? Most likely the value is constant for the duration of the loop, thus it belong outside the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the given reason, you should always attach your VI. Even if the subVIs are missing, it can give us much richer information to debug the situation.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 06:59:25 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602951#M781635</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2013-10-26T06:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602953#M781636</link>
      <description>&lt;P&gt;can you attach small section of code ?&lt;/P&gt;
&lt;P&gt;Because it is not possible that if you are getting different values at every iteration of For loop from 'Encrypt XETA' vi then you are not able to get it outside the For loop with indexing enabled.&lt;/P&gt;
&lt;P&gt;Or directly index the two outputs of '&lt;SPAN&gt;Encrypt XETA' vi and check what do you get&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:01:03 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602953#M781636</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T07:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602955#M781637</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Of course all your values are the same, because you are always reading the&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;same file&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;(that operation probably belongs before the loop because the outcome will not change between iterations!) and are indexing out the&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;same elements&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;(with indices 2 and 3). Note that you are wiring from the inside of N, which simply returns "2" in your case, irrespective of the iteration number. If you want to index out locations that depend on the iteration number, you need to tap into the [i] terminal, not "N"&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;SPAN&gt;Christian, No excuses , I didnt pay a lot attention while replying.&lt;img id="smileyembarrassed" class="emoticon emoticon-smileyembarrassed" src="https://forums.ni.com/i/smilies/16x16_smiley-embarrassed.gif" alt="Smiley Embarassed" title="Smiley Embarassed" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sorry about that&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yeah, I thought it was just a demo&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:14:38 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602955#M781637</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T07:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602957#M781638</link>
      <description>&lt;P&gt;I am not sure, if this will help here is my vi. It is saved in labview 2013&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:11:29 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602957#M781638</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T07:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602963#M781640</link>
      <description>&lt;P&gt;You didnt attach Subvi and sample sound file.&lt;/P&gt;
&lt;P&gt;Still it is very clear form&lt;SPAN class="login-bold"&gt;&amp;nbsp;altenbach's explanation why you are getting same values every time&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:20:43 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602963#M781640</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T07:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602965#M781641</link>
      <description>&lt;P&gt;The file I am read in is a wav file with roughly ~5000 data points. For the purpose of simplicity, I choose a C value of 2. It does not matter what C value I choose the array does not build properly. I just need to find a way to build out the array.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:27:58 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602965#M781641</guid>
      <dc:creator>kulsman</dc:creator>
      <dc:date>2013-10-26T07:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602969#M781643</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/278563"&gt;@kulsman&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The file I am read in is a wav file with roughly ~5000 data points. For the purpose of simplicity, I choose a C value of 2. It does not matter what C value I choose the array does not build properly. I just need to find a way to build out the array.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are not listening. Your loop does &lt;U&gt;exactly the same thing&lt;/U&gt; with every iteration, because nothing depends in the iteration value i.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is "C"???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is code that might bring you a little bit closer to a solution. (there are still quite a few unanswered questions and problems, but this might get you started)&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:44:35 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602969#M781643</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2013-10-26T07:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: for loop array issue</title>
      <link>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602973#M781645</link>
      <description>&lt;P&gt;you are not getting the point&lt;/P&gt;
&lt;P&gt;In the pic you have attached you are reading the file with 5000 samples so every iteration of For loop the array is same containing 5000 elements( because you are reading the same file in loop)&lt;/P&gt;
&lt;P&gt;Now you are interested in a fixed indexed values ( beacuse the values you are wiring to index array are constant ).&lt;/P&gt;
&lt;P&gt;{ at this point i think you need different elements from the array every time}&lt;/P&gt;
&lt;P&gt;So original array will always give you the same values.&lt;/P&gt;
&lt;P&gt;and build array will act accordingly..........&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2013 07:46:21 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/for-loop-array-issue/m-p/2602973#M781645</guid>
      <dc:creator>Neos</dc:creator>
      <dc:date>2013-10-26T07:46:21Z</dc:date>
    </item>
  </channel>
</rss>

