LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop a while loop with array outside

Solved!
Go to solution

Hi nousome,

 

Take a look at your're diagram in debug mode(lamp)

dan you can see what's happening with your data.

 

may be this is what you're looking for.

Create a for loop over the complete diagram, except for the array with times.

disable the index and create another wire to the for from the array and enable the index. (see picture)


Fred

0 Kudos
Message 21 of 57
(2,495 Views)
Thank you for the reply. I tried your solution but it doesn't work. You can see it in the attached code. Thank you again.
0 Kudos
Message 22 of 57
(2,487 Views)
0 Kudos
Message 23 of 57
(2,486 Views)
Thank you for the reply. I tried your solution but it doesn't work. You can see it in the attached code. Thank you again.
 

AttachmentUntitled 1.vi (20 kb)

0 Kudos
Message 24 of 57
(2,467 Views)

Hi,

 

I worked a lot on this vi and I didn't success to make it work. I attached here my work. What I would like to do is to build an array as Raven's fan did that select randomly among an existing array without replacement (no more than one presentation per 5 trials). I would like more that 5 trials so at the 6th trial the new array could select among all the existing values of the 1st array. The problem that I encounter is I can't set more than 4 trials.

 

The other problem is that in the second sequence the function index value returns only one of the element and always this value because there is only one element in index. I don't know how to pick up each value in this architecture. Perhaps someone could fix this problem. I thank you in advance.

Download All
0 Kudos
Message 25 of 57
(2,416 Views)

I'll start with the 2nd question first.  You only get a single element because that is what you are indexing out of the array before the 2nd loop starts.  The while loop keeps using that same element.  Which element that is depends on the last value of that wire as it comes out of the loop.  Either move the index array inside the loop and wire the iteration terminal of the loop to it.  Or better yet, turn the while loop into a For Loop.  Have the array go in as an autoindexing tunnel.  Then you can eliminate the index array and also the code that counts how many times the loop has run.

 

For the first question, you will have to modify the code a bit.  Once you have reached the count where the Used Array has filled up with all true, use a case structure to reset them all to False so that it is cleared for another round of choosing.  The comparison could be And Array Elements.  When that is true, you know its filled up.  Then you could And the array with a single False Boolean in a case structure to clear all the elements.

0 Kudos
Message 26 of 57
(2,407 Views)
Thank you I will try your solution.
0 Kudos
Message 27 of 57
(2,391 Views)

Hi,

 

I worked on your solution and have still some troubles. I have well the array go in as an autoindexing tunnel but so I have problems to wire with my second loop to count time because it is an array. If I use index array I have still the same problem.

 

For the second solution I am not sure to understand how to do, I understand the reasonning but I am not sure to apply well the solution.You could see in the code attached here. Thank you very much for your help. 

Download All
0 Kudos
Message 28 of 57
(2,387 Views)

My reply #26 was supposed to be the solution.  But looking at it now, it looks like the wrong version of Untitled 1.  I'll look around on my hard drive to see if I can find it again.

 

It looks like you replaced the wrong while loop with a For Loop.  I said the 2nd loop.

 

Let me see if I can find my solution again and repost it.  If not, I'll redo it.

 

EDIT:

 

I found it.  When I back saved it to LV8.0 yesterday, it buried it and the subVI in weird subdirectories on my desktop.

Message Edited by Ravens Fan on 12-03-2008 09:33 AM
0 Kudos
Message 29 of 57
(2,376 Views)
Okay thanks a lot.
0 Kudos
Message 30 of 57
(2,370 Views)