Skip to content
Discussion options

You must be logged in to vote

You could store your images as an array of objects, where each object contains the image name with and without the special characters. Then you could shuffle this array, and access the two different properties of this object when you need the filename vs names that are shown on the screen. E.g.

var images = [
  {path: 'stims/wirbelsaule.jpg', name: 'Wirbelsäule'},
  {path: 'stims/another_stim.jpg', name: 'Another stim'},
  // etc.
];
var images2 = jsPsych.randomization.shuffle(images);  // stimulus objects are now in random order
//...
stimulus: function(){
    var first_stim = images2.pop(); // this is now an object with keys called 'path' and 'name'
    var first_stim_filepath = first_stim

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jodeleeuw
Comment options

@AnneVogt
Comment options

Answer selected by becky-gilbert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants