LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loop array one by one

Solved!
Go to solution

Hi All,

How can I change this VI to have the output array updated on each loop iteration instead of waiting for the program to exit the loop and then update all?

Thanks

0 Kudos
Message 1 of 11
(3,913 Views)

I cannot view it with LabVIEW 2014, but my guess is that your indicator is outside your loop, and it has to be inside to update every iteration. If you are using auto indexing, this means switching over to a shift register along with "replace array subset/element" (assuming you initialize your array). 

 

If you post a snippet I can get a better view,

 

Thanks

Message 2 of 11
(3,893 Views)

Same here as greg. Need 2014 or older and it probably is a dataflow issue.

 

LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.

 

 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 3 of 11
(3,890 Views)
Solution
Accepted by H7N

You need to use a shift register for the array and use build array inside the loop.  Move the indicator terminal inside the loop.

 

Message 4 of 11
(3,877 Views)

And to simplify a little more by using a FOR loop...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(3,841 Views)

OK,

 

Somebody backsave that to 2014.  Why aren't we using a for loop with a conditional output tunnel rather than a SR?  Tim's code looks like "build Array from null until stop or array index".  What am I missing this close to midnight?

 

Spoiler
I must need sleep!  Tim and Bill don't miss that often

"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 11
(3,820 Views)

The OP said they want to see the array update while the loop was still iterating.

 

Tim missed because he put the terminal outside the loop.

 

I'm assuming the original VI was all just academic because it only iterates 5 times and would happen near instantly.  And the while loop doesn't make much sense for a defined size array as Tim pointed out.  But what the OP posted was just a simple example to demonstrate where they were at the moment.

 

Actually, what I showed may not match the requirements.  I showed the array being built one by one.  If it is a case of seeing the entire original array to start and it being updated each iteration with the +1,  I probably should have used replace array subset.

 

EDIT:  I see that is what GregoryJ suggested, just that he hadn't posted yet by the time I started coding up the example and posted my message.

Message 7 of 11
(3,807 Views)

@RavensFan wrote:

The OP said they want to see the array update while the loop was still iterating.

 

 

 

EDIT:  I see that is what GregoryJ suggested, just that he hadn't posted yet by the time I started coding up the example and posted my message.


Makes more sense now.

 

H7N, Could you be a bit more specific about what you need?  (And that 2014 backsave would help a lot!)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 11
(3,788 Views)

@RavensFan wrote:

Tim missed because he put the terminal outside the loop.


Looks like I needed the sleep as well...  Time to start a new day.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 11
(3,761 Views)

Thank you all for your replies.

 

 

0 Kudos
Message 10 of 11
(3,701 Views)