取消
显示结果 
搜索替代 
您的意思是: 

Stop a while loop with array outside

已解决!
转到解答

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 项奖励
21 条消息(共 57 条)
3,154 次查看
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 项奖励
22 条消息(共 57 条)
3,146 次查看
0 项奖励
23 条消息(共 57 条)
3,145 次查看
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 项奖励
24 条消息(共 57 条)
3,126 次查看

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.

下载全部
0 项奖励
25 条消息(共 57 条)
3,075 次查看

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 项奖励
26 条消息(共 57 条)
3,066 次查看
Thank you I will try your solution.
0 项奖励
27 条消息(共 57 条)
3,050 次查看

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. 

下载全部
0 项奖励
28 条消息(共 57 条)
3,046 次查看

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 项奖励
29 条消息(共 57 条)
3,035 次查看
Okay thanks a lot.
0 项奖励
30 条消息(共 57 条)
3,029 次查看