LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

randomized 20 trials for 6 digital channels

Hi,
I want to randomize 6 digital outputs , 20 times but each channel must be switch on only 20 times and one channel must not be triggered twice in a row !
I know i have to use a for loop bu i dont know how to say to the software, just trigger them 20 times and stop it after.

Thanks for your reply
0 Kudos
Message 1 of 3
(2,423 Views)
I don't think you can generate a truely random sequence. It will just cost you a too large number of trials. I have calculated that you need about 1.25 x 10^9 assays before generating a single random sequence without any duplicate consecutive channel adress.

What you can do is to use a pseudo random sequence by associating four random sequences of 30 channel adresses, after checking that the last and first channels are different !

You can use the attached vi to generate your sequence. Try first with only few replicates (5-6...), otherwise you may think that the program is not working !..
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 3
(2,415 Views)

Disregard my previous post : if the sequence is generated progressively, channel after channel, just checking that there is no immediate repeat, a solution is rapidly found.

The attached vi does the job.

Enjoy !

Chilly Charly    (aka CC)
0 Kudos
Message 3 of 3
(2,392 Views)