LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner Question: Extracting Array Values From Nested Loops

I meant yes, silly me and I can't see and edit button :).

0 Kudos
Message 11 of 17
(891 Views)

See if these help.

Download All
0 Kudos
Message 12 of 17
(886 Views)

Thanks for the VIs. I'm nearly done (I've done task 1, onto task 2 right now). I'm using two nested "for loops" for write to two arrays. Now I've got the loops to increment the values correctly, it's just that it doesn't correctly write them to the arrays, it is overwriting the values written from the previous iteration. I think I may need to use the "build array" function to correctly apend the array but I can't seem to get it working. I've attached the VI I'm working on, it's quite straightforward, once I've got the basics of it working I can integrate it into the larger, main VI.

 

If anyone can suggest how to fix this, I would be very greatful.

 

 

0 Kudos
Message 13 of 17
(871 Views)

I cant look at the code from home currently, but a common problem is that build array adds a dimension making your 1D array into a 2D array. If that's what happens you'll simply need to r-click the build array and change it to "append arrays".

 

Looking at your post after my posted vi that seems to be what's happening. As i mentioned, modify as needed, it's a start. 😉 Reshape array and/or changing the build array should solve it. 

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 17
(863 Views)

As a warning to everyone else, when I clicked on the first link in the original post, I got some popups, including porn.  Might be related to the image hosting site.

0 Kudos
Message 15 of 17
(858 Views)

One of the concepts your missing is that for loops don't always need a wire to N. When you pass an array to a for loop and you want the for loop ot process each value of the array use indexing. Right click on the node (tunnel)  passing through the for loop wall and select "Enable indexing".

 

Search the examples for auto-indexing and open "Separate Array Values.vi"

0 Kudos
Message 16 of 17
(847 Views)

I have succeeded, I used the build array function, to create the values and then I used the reshape array function to make it a 1D array again. Thanks for the help.

 

P.S. Sorry about the pop-ups on imagevenue I use adblock so I wasn't aware of them. If a mod wants they can remove the links from my post.

0 Kudos
Message 17 of 17
(834 Views)