LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build array

i want to store some elements programatically in to array.i used build array function and also tried with insert in array function.I am attaching my vi i am expecting that at loop termination the array should contain multiple of 5 but it always contain zero. any suggestion.
thanks
0 Kudos
Message 1 of 13
(4,490 Views)

Your VI wasn't attached, but usually with arrays and loops there are 2 common modes of operations - wiring something out of the loop and auto indexing it so it is built into an array or initializing the array before the loop and using Replace Array Subset with a shift register to replace elements in the array.

Usually, the only reason to use resizing operations (Build Array, Delete from Array, etc.) inside a loop is if you have to analyze data inside the loop and use only some of the data and you don't know the array size in advance. In this case too you need to use a shift register to pass the array from one loop iteration to the next.

As for what you say, that you always get zero (an empty array?), this is often caused by auto indexing 2 different arrays into the loop. The number of times the loop will run is determined by the smallest number, so if you auto-indexed an empty array into a for loop, the for loop will run 0 times, and the array coming out of it will be empty.


___________________
Try to take over the world!
0 Kudos
Message 2 of 13
(4,479 Views)
Hi
Two  points:
 if you drag and increase the size of your arrays you will find that you do have mutiples of 5.

In VI properties under execution you should set allow debugging button !!

This will allow you to step through your 'code'

Also enables the highlighter so you can actual see the data valves as they flow.


chow
xseadog
0 Kudos
Message 3 of 13
(4,477 Views)
i am again attaching my VI hope this time it will attached.
0 Kudos
Message 4 of 13
(4,473 Views)
i am atrying to attached my vi evry time time i browse it form my PC and then click submist post button but it is not attaching i dis send attached file but today it is not working:)
0 Kudos
Message 5 of 13
(4,470 Views)

Actually, the VI was attached to all of your posts, but some for some reason there is no link to it.

Here is the VI. I can't open it because it's 7.1.


___________________
Try to take over the world!
0 Kudos
Message 6 of 13
(4,465 Views)
i am anow sending the vi in form of png file.check it.
0 Kudos
Message 7 of 13
(4,459 Views)
The reason you are not seeing the multiples of 5 is because you are making 2-D arrays out of the For loop.  On your front panel, the multiples of 5 are in the first column of the "Array" indicator.  Just expand your indicator down and you will see (or see my attachment).  From your code, it is unclear as to what you want to do.  Do you want a 1-D array output with multiples of 5 or were you originally looking for a 2-D array with the multiples of 5 stored in the row instead of a column?
0 Kudos
Message 8 of 13
(4,453 Views)
Here is the original code.
0 Kudos
Message 9 of 13
(4,450 Views)
I might have also read your question wrong.  The iteration terminal is zero based so if you loop five times, the iteration terminal will increment from 0 to 4 instead of 1 to 5.  Your first calculation is 0 x 5 = 0 instead of 1 x 5 = 5.  To make it one based, add 1 to the iteration terminal before multiplying by 5.
0 Kudos
Message 10 of 13
(4,446 Views)