问题描述
在这种情况下,我试图保存一个时间线变量 border_color。对于每次试验,我都会改变刺激周围边框的颜色(从数组 border_color 中随机选择它)。 但是,我现在正在努力为我的数据中的每个试验保存边框(颜色),即我想在导出它时看到一列边框颜色,然后它在数组中包含值(红色、蓝色)。
我对 js 还是很陌生,如果这很明显,我很抱歉。 我尝试了以下变体: 数据:{frame_color: border},
但没有运气。
如果有任何建议,我将不胜感激!
var trial = {
type: "categorize-image",stimulus: jsPsych.timelineVariable('stimulus'),key_answer: jsPsych.timelineVariable('key_answer'),choices: ['space'],border: jsPsych.timelineVariable('border_color'),stimulus_duration: 1000,trial_duration: 1000,feedback_duration: false,response_ends_trial: false,post_trial_gap: 500,//interstimulusinterval
on_start: function(trial){$("#jspsych-content").css({'border-color': trial.border[0],'border-style':'solid','border-width':'40px'})},on_finish: function(){$("#jspsych-content").css({'border-color': "white",};
解决方法
您可以使用 data
参数将试用版添加到试用版中。这些是来自 jsPsych 的 relevant docs。
var trial = {
...,data: {
border: jsPsych.timelineVariable('border_color')
}
}