Post by matia on Jul 23, 2021 6:27:06 GMT
Hello everyone,
I have an experiment ready to run, but I just can't look at my code as it is really ugly. The problem is the following (bear in mind, this is a simplification of my problem), I have a table:
#@1stimulus @2stimcode @3position @4color @5condition
stim1 1 left black 1
stim2 2 right black 1
stim3 3 center black 1
stim4 4 left red 2
stim5 5 right red 2
stim6 6 center red 2
The way in which I've made this experiment is by having two different tables, and ofcourse two different tasks - two different blocks. And since this is a simplification, in the actual experiment, I will have 8 tables/tasks/blocks... That doesn't make sense.
I have 2 ideas on how I would go about this, but cant seem to work it.
1. I've tried to define a random number in the options (I though I could do this, but apparently you cant)
options
set &a random 1 2
and in that case my table would consist of three rows only:table MyTable
#@1stimulus @2stimcode @3position @4color @5condition
stim1 1 left black 1
stim2 2 right black 1
stim3 3 center black 1
and if that worked, I would start the task syntax by saying something like:task MyTask
if &a == 1
set $stimulus @2
fi
if &a == 1
set $stimulus @2+1
fi
That seems much more concise.2. Different approach would be to have a complete table (with 6 rows) and then say that the trials should be sampled from the rows where @5 == $x and $x should be a random number between 1 and 2 - but for one participant the whole time...
I hope I was clear. And I know it is not too important, since I already made my experiment to run, but I get nervous when I see there are 500 rows of syntax when I know there should only be couple of dozens.
Thanks all!
Best, Matia
Best, Matia
***SOLVED***
it is possible to do what I wanted to do in number 1. I can set a random number in a survey and then call it in the experiment!
#SURVEY SYNTAX
l: variable1
t: set
- random 1 2
#EXPERIMENT SYNTAX
options
var in variable1
task MyTask
if &variable1 == 1
set $target @2
fi
if &variable1 == 2
set $target @2+1
fi
Gonna leave it here if anyone else encounters similar problem!
But, if anyone has a way of filtering using information in tablerow, please tell me