function call as stimulus #1313
-
Hey everyone, I need your help in the following matter.
Thanks for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @idoba2030, one way to do this is to use a global variable to store the current value of your memory array each time it changes in the var current_memory_stim = null; // set up a global variable to hold your memory stimulus
var memory_array = function (condition) {
number_of_images = parseInt(condition[0])
locations = get_locations(location_names, number_of_images)
squares_array = get_squares(change_detection_images, number_of_images)
var squares = '';
for (index = 0; index < number_of_images; index++) {
squares += locations[index] + squares_array[index] + ">"
}
var target = locations[0] + squares_array[0] + ">"
// update the value of the global variable each time the memory_array function is called
current_memory_stim = [squares, target];
return current_memory_stim;
}
var memory = {
type: "html-keyboard-response",
stimulus: function () { return memory_array(condition)[0] },
choices: jsPsych.NO_KEYS,
trial_duration: 200,
}
var test = {
type: "html-keyboard-response",
stimulus: function () {
// use current_memory_stim to access the memory array from the last trial
// and use that to generate your stimulus here
},
choices: [83, 75],
trial_duration: 6000
} I hope this helps. Feel free to post here if you get stuck! |
Beta Was this translation helpful? Give feedback.
Hi @idoba2030, one way to do this is to use a global variable to store the current value of your memory array each time it changes in the
memory
trial, and then in yourtest
trial, access that variable in the stimulus function, like this: