I was getting the same error, but now I played with it a little and I think I know where the problem is but I don’t know how to fix it. I tried the experiment while keeping the selected rows completely blank, followed by 0:5, followed by 1,3,5 and they all worked (I have no clue why simply putting 1 doesn’t work though, maybe because it’s not an array?).
Do you know what type of arguments selected rows takes (or rather the function that imports the excel file, TrialHandler.importConditions(psychoJS.serverManager, ‘Practice_sound_files.xlsx’, ‘0:5’))? It works in psychopy because it’s a psychopy function that accepts list, but I don’t know if it works differently with Javascript. I’m have code that creates a list of the rows to read in order to create my different conditions. I just went through the JS code and corrected some things so that the variable used in selected rows is a list. Here is the code
// add-on: list(s: string): string[]
function list(s) {
// if s is a string, we return a list of its characters
if (typeof s === 'string')
return s.split('');
else
// otherwise we return s:
return s;
}
function range(start, end) {
var ans = [];
for (let i = start; i <= end; i++) {
ans.push(i);
}
return ans;
}
shuffle = util.shuffle;
bl_inst = "blabla1";
int_inst = "blabla2";
//Assign counterbalance order
sub_num = expInfo.participant;
CB = (sub_num % 4);
//Assign sets of stimuli to conditions(ex. block1 includes stimuli 1 to 14 in excel file)
if (((CB === 1) || (CB === 2))) {
block1 = list(range(0, 14));
block2 = list(range(14, 28));
block3 = list(range(28, 42));
inter1 = [42, 56, 70];
inter2 = [43, 57, 71];
inter3 = [44, 58, 72];
inter4 = [45, 59, 73];
inter5 = [46, 60, 74];
inter6 = [47, 61, 75];
inter7 = [48, 62, 76];
inter8 = [49, 63, 77];
inter9 = [50, 64, 78];
inter10 = [51, 65, 79];
inter11 = [52, 66, 80];
inter12 = [53, 67, 81];
inter13 = [54, 68, 82];
inter14 = [55, 69, 83];
} else {
if (((CB === 3) || (CB === 0))) {
inter1 = [0, 15, 29];
inter2 = [1, 16, 30];
inter3 = [2, 17, 31];
inter4 = [3, 18, 32];
inter5 = [4, 19, 33];
inter6 = [5, 20, 34];
inter7 = [6, 21, 35];
inter8 = [7, 22, 36];
inter9 = [8, 23, 37];
inter10 = [9, 24, 38];
inter11 = [10, 25, 39];
inter12 = [11, 26, 40];
inter13 = [12, 27, 41];
inter14 = [13, 28, 42];
block1 = list(range(42, 56));
block2 = list(range(56, 70));
block3 = list(range(70, 84));
}
}
shuffle(block1);
shuffle(block2);
shuffle(block3);
shuffle(inter1);
shuffle(inter2);
shuffle(inter3);
shuffle(inter4);
shuffle(inter5);
shuffle(inter6);
shuffle(inter7);
shuffle(inter8);
shuffle(inter9);
shuffle(inter10);
shuffle(inter11);
shuffle(inter12);
shuffle(inter13);
shuffle(inter14);
bl_list = [block1, block2, block3];
in_list = [inter1, inter2, inter3, inter4, inter5, inter6, inter7, inter8, inter9, inter10, inter11, inter12, inter13, inter14];
bl_range = list(range(0, 3));
in_range = list(range(0, 14));
shuffle(bl_range);
shuffle(in_range);
part1_order = [];
part2_order = [];
//Creates trial order
if (((CB === 1) || (CB === 3))) {
part1_inst = bl_inst;
part2_inst = int_inst;
part1_order = ((bl_list[bl_range[0]] + bl_list[bl_range[1]]) + bl_list[bl_range[2]]);
for (var lists, _pj_c = 0, _pj_a = in_range, _pj_b = _pj_a.length-1; (_pj_c < _pj_b); _pj_c += 1) {
lists = _pj_a[_pj_c];
part2_order = part2_order.concat(in_list[in_range[lists]]);
}
} else {
if (((CB === 2) || (CB === 0))) {
part2_inst = bl_inst;
part1_inst = int_inst;
part2_order = ((bl_list[bl_range[0]] + bl_list[bl_range[1]]) + bl_list[bl_range[2]]);
for (var lists, _pj_c = 0, _pj_a = in_range, _pj_b = _pj_a.length-1; (_pj_c < _pj_b); _pj_c += 1) {
lists = _pj_a[_pj_c];
part1_order = part1_order.concat(in_list[in_range[lists]]);
}
}
}
I’m using part1_order and part2_order as variables for selected rows.