Home Questions Is there a way to put constraints on trial randomization?

Is there a way to put constraints on trial randomization?

DWQA QuestionsCategory: Custom Task DevelopmentIs there a way to put constraints on trial randomization?
Aaron Wong asked 5 years ago
Hi, I would like to be able to psudeorandomize my trial protocols such that you get one of each trial protocol type before repeating, but in addition, ensure that there are no repeated trials of the same type. That is, I know that you can pseudorandomize by writing one of each TP type in the TP list, changing the number of list reps, and then clicking the randomized option, but is there any way to ensure that the last TP of one list rep is not the same as the first TP of the next list rep?
Aaron Wong replied 5 years ago

Thanks in advance for any suggestions!

1 Answers
Duncan McLean Staff answered 5 years ago
Hi Aaron, Yes, there is a way to do this. You will need to do some record keeping in your Stateflow diagram of which trial type has just run. Next, you will need to enable the "repeat trial flag" input on the GUI Control Block (double click the block to find the check box). From your state flow you will create a new variable that is set to a 1 when you want to repeat a trial at the end of a block and connect that stateflow output to the GUI Control block's repeat trial flag input. Finally, edit your task protocol and be sure to check "Use repeat trial flag" on the General tab. You Stateflow will do something like: 1. Start a trial - compare ID of last trial run to current trial. If they are different, continue as normal. 2. If the trials are the same set the "repeat trial" flag to 1. 3. End the trial. 4. Reset the "repeat trial" flag to 0 for the next trial. This is critical or every trial will be repeated. Please let me know if you'd like any further detail on this. Cheers! Duncan