| Reference | Downloads | Github

Selection of random trail

What did you try to make it work?:
I have a set of images in the first trail. In the second trail subject will be asked to choose one of the image and then it will move to that specific trail. After the completion of that specific trail subject should be asked again to choose one of the images to start the next trail until all the trails.
I have attached the screen shot of the PsychoPy for better understanding.

What specifically went wrong when you tried that?:
I am new to the Psychopy could anyone have some suggestions in this regard?
Include pasted full error message if possible. “That didn’t work” is not enough information.

I would strongly recommend that you re-approach this issue with a loop.

Routines that are almost the same should be identical and then customised by using variables from a spreadsheet or code.

@wakecarter Thank you, for your reply. So, I have to add a loop in each trail from trail_0_ to trail_11_ as shown in the above?

I’m suggesting deleting trial 1 to 11 and modifying trial 0 so it can act as all 12 if there’s a loop around it pointing to a spreadsheet.

NB Avoid ending routine names with an underscore.

@wakecarter each trail contains different set of images then how to manage them in a single trail?

That’s where the spreadsheet comes in.

In your images you set the image names as, for example, $img1 $img2 $img3 etc

In your spreadsheet you have columns called img1 img2 img3 etc.

In those columns you put the filenames of the images. One row for each trial.

If this is unfamiliar to you, you might find my PsychoPy Primer slides useful (or various tutorial videos).

1 Like

@wakecarter I have made a spreadsheet for the loop. And how to select the no of the trail so that corresponding trial work. Moreover, I also have to add images in the trail1 routine?
Please have a look on snapshot.

The trials (rows in your spreadsheet) will be selected at random.

@wakecarter in trailselection routine participants will be asked to choose which trail they want to see first how could that be done?

If your trial selection routine is before your loop starts then you could select a row using the selected rows feature.

If you put $useRows as selected rows then if useRows = "0:1" you’ll get the first row of the loop only.

@wakecarter I will rephrase my question in trail selection routine participant will be asked to select one of the trail from trail0 to trail11 as shown above and afterwards the same question will be asked until the all trail complete. How could that be done?

If you want a selection page where up to 12 images are shown followed by the selected trial, then looping back to show 11 images etc until all trials have been selected then I could code that for you in 2-3 hours but I don’t think I can guide you through doing it yourself because of the coding required to stop participants reselecting an already selected trial.

Please message me if you are interested.

@wakecarter sure that would be great helping hand.