Different image every trial

Hey Chris,

I hope you’re doing fine
justing starting to use .mwel instead of .xml.

Now I got a rather simple .mwel question I believe.

I would like to present a different image every trial.

I set up a loop for some images. It looks like this:

stimulus_group images {
range_replicator (
variable = index
from = 1
to = 100
step = 1
) {
image_file j${index} (
path = ‘jpg/j${index}.jpg’
x_size = 15
x_position = TRIAL_cali_fixpoint_x
y_position = TRIAL_cali_fixpoint_y
)
}
}

So far so good.

Now when I want to queue the images (sequentially or randomly - does not matter) what will I have to write in the trial procedure

live_queue_stimulus (?)
queue_stimulus (?)

Maybe you have a template of sorts that I can use?
Thanks for your help with this,

Marcus

Hi Marcus,

You need to write

queue_stimulus (images[image_index])

where image_index is an expression that evaluates to an integer between 0 and 99. Typically, you would generate the index expression using either another range replicator within your protocol or with a selection variable. The attached example demonstrates both approaches.

Note that there’s nothing specific to MWEL here. All of this works exactly the same way in an XML-based experiment.

Cheers,
Chris

Attachment: image_rep.zip (305 KB)