+xHi, I would like to run a block to remove outlier before the finish block to get the average value when outliers are removed. Below is what I have in mind as an outlier block, but when I run it, the list.RTremove.mean is zero. Could you please tell me what I am doing wrong?
<block outlier>
/ onblockend = [
var i=0;
var RTmin= list.RT.mean - 3 * list.RT.standarddeviation ;
var RTmax = list.RT.mean + 3 * list.RT.standarddeviation;
var num = list.RT.poolsize;
while (i <= num ) {
var currentvalue = list.RT.item(i);
if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)
{ list.RTremove.appenditem(values.currentvalue) ;
};
i++;
};
]
</block>
Three issues at a glaince.
- You intialize i with value 0. Lists in Inquisit 6 start with index 1 (not 0), so in the first iteration of the loop, when i is still 0
var currentvalue = list.RT.item(i);
will not retrieve anything.
- There's no ++ operator in Inquisit 6, so
i++
will not increment i. The above should be
i += 1
- The below makes little sense:
var currentvalue = list.RT.item(i);
if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)
{ list.RTremove.appenditem(values.currentvalue) ;
};
A var is a temporary variable (local scope). You define a var called currentvalue.
A value is a different thing. <values> are global variables, and values.currentvalue is an entirely different entity than the local var called currentvalue you defined.
For anything more, you will need to provide actually runnable code, i.e. include the relevant lists and test vectors.