different image every trial

marcus.haag's Avatar

marcus.haag

04 Oct, 2021 04:01 PM

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

  1. Support Staff 1 Posted by Christopher Sta... on 05 Oct, 2021 01:52 PM

    Christopher Stawarz's Avatar

    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

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac