11-24-2008 03:52 AM
The solution given by Pnt works fine. Now I would like something a little bit complicated. I would like that first before each value from the array is running, that the user clicks to a button to start the waiting time (I know how to do this with event structure). After I would like that at the 90% of the time of waiting given by the differents by the array, some event appeared (I guess that I could do this in case structure) during 500 ms and then the remaining time has to be elapsed and another event appears. For example, for a value of 10s, at 9 sec, an event appeared during 500 ms and this event disappeared and following 500 ms another event appeared during 500 ms. After 1 sec, another value from the array is running.
Thank you for the help.
11-24-2008 08:12 AM
What is "differents"?
Your description isn't too clear. Perhaps you can draw a picture or a timeline or something to describe this.
11-24-2008 08:53 AM
Okay I'm sorry I will try to make it clear.
Each value from the array represent an individual trial. At the beginning of each trial I would like that the user clicks to a button to start the wait time (I know how to programate a click on the button but I can't with this architecture program in the way that the button appears back with each new value from the array). After 90% of the time of waiting (so if the value in the array is 10 sec, after 9 sec) a stimulus appears during 500 ms and disappears. And after the value is elapsed (i.e., after 10 sec) another event appears. For these two events to program no problem. After the delay is elapsed i would like to have 1 second of waiting after the new trial (and make appear the circle).
My aim actually is to select randomly from the array one of the 9 values. When this value is selected it can't be used again. I would like the loop ends after a x number of trials. I wonder so if array is well suited for my problem. I know the random number function but I can not easily remove a value when it was used. I hope that I am clear.
11-24-2008 09:13 AM
Sure, an array is perfect for this.
You would probably want another array of booleans where each index matches up with a value in your numeric array. Once you select a value and use it, set the same index in the boolean array to true. When you randomly choose a value in the numeric array again, check to see if the boolean flag is true. If it is still false, use the value and change the flag to true. If it is true, choose another random number and check again. Keep the number of values used in a shift register and stop the larger while loop after that number matches your desired "x" trials.
11-24-2008 12:01 PM
Thank you very much for the reply. I am not sure to understand could you give me a picture of this please if you have any time. I thank you in advance
11-26-2008 07:57 AM
11-26-2008 08:41 AM
11-26-2008 10:44 AM
11-26-2008 12:42 PM
11-27-2008 03:05 AM
Thank you very much for the solution given. I tried to apply this in my program but it didn't work. I would like to use each value given by the array as time and when this time is elapsed a change in the font of the screen to yellow appears during 1/2 sec and after 1.5 sec I would like that the next interval given by the array is selected. I would like the array runs for 10 or more trials, so that after 5 trials and all values are selected the array of boolean returns to 0 to let select among all the values.
Here in the VI runs only for one value and stops even though I set the number of trials to 5. Thanks. I attached the code here