03-15-2016 06:34 PM
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
Solved! Go to Solution.
03-15-2016 06:43 PM
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
03-15-2016 06:44 PM - last edited on 12-16-2024 04:13 PM by Content Cleaner
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> ---'
03-15-2016 06:52 PM - edited 03-15-2016 06:56 PM
You need to use a shift register for the array and use build array inside the loop. Move the indicator terminal inside the loop.
03-15-2016 08:15 PM - edited 03-15-2016 08:15 PM
And to simplify a little more by using a FOR loop...
03-15-2016 11:55 PM
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?
03-16-2016 12:18 AM - edited 03-16-2016 12:27 AM
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.
03-16-2016 12:36 AM
@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!)
03-16-2016 05:33 AM
@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.
03-17-2016 01:57 PM
Thank you all for your replies.
RavensFan's solution was spot-on exactly what I wanted.
I'm going to try the one with the for loop as well but I think apart from the O/P array that should be inside, it works the same.
For those who asked, here's the VI saved as V14 compatible.