|
Post by AEC on May 4, 2020 11:54:13 GMT
Hello there,
I am new to PsyToolkit, but I have some knowledge in creating experiments in Matlab. My aim is to try out, if I can conduct experiments using this platform, which is looking very promising to me. I have watched the videos on how to create an experiment and read through the lessons and syntax explanations.
What I am trying to do is as follows:
There are 3 symbols, which I would like to show either only with 3 positive pictures, 3 negative pictures, or 3 neutral pictures. I have made a table, which contains the picture names and their assigned valence. In addition, I wrote in the table the global variables, which I would like to set containing one of the three symbols I would like to pair with the other pictures.
In the block containing the task I tried to assign my three global variables randomly with one of the three symbols using the number at which each symbol appears under bitmaps (they appear as 3rd, 4th, and 5th in the list).
block ECMain set &my_pos random 3 5 set &my_neu random 3 5 while &my_pos == &my_neu set &my_neu random 3 5 while-end set &my_neg random 3 5 while &my_neg == &my_neu set &my_neg random 3 5 if &my_neg == &my_pos set &my_neg random 3 5
fi while-end
tasklist ECtask 5 all_before_repeat end
The reason for this attempt is that each symbol should only be paired with pictures of one valence and none of the others. Following, each time the experiment is done, a symbol is randomly assigned to a valence and it stays this way throughout. As far as I understand it, using a local variable in the task would risk a change in pairing for each trial.
The problem: When I try to compile the experiment I receive the following error code:
ERROR: unknown_statement in line: 49 >>> while &my_pos == &my_neu Problem: Unknown statement. Solutions: - Could this be a typo? - Check the PsyToolkit syntax.
Unfortunately, I do not see what I am doing wrong.
If anyone has an idea on how to solve this, please let me know. Thank you.
|
|
|
Post by PsyToolkit on May 4, 2020 14:41:41 GMT
In your code, you use "while" loops in the "block". You can only do so in the "task" description. So basically, you need to put that in your task, not in your block.
The reason why it says "unknown statement" is because you are trying to do things that are not recognized as possible instructions to be used in that part of the code.
|
|
|
Post by AEC on May 4, 2020 14:47:50 GMT
Thank you for your quick response. By using the random assignment in the task, would this not mean that in every trial the variable is set to a new number/symbol? Is there a way to define global variables once and keep this value throughout an experiment? Your help is much appreciated.
|
|
|
Post by AEC on May 4, 2020 15:21:25 GMT
My last question was not well phrased. Is there a better way to randomly assign my symbols to one of three possible options, so no symbol is assigned to the same option, and this assignment is kept throughout the experiment?
|
|
|
Post by PsyToolkit on May 4, 2020 17:17:50 GMT
I understand what you want, there are two ways to do this. The easiest way is probably just to create a new task called
task create_my_variables ...code to set your variables...
Then you have a block in which there is just one trial at the beginning of your experiment. Participants would not notice it, but all it does is set the variables.
block my_pre_block tasklist create_my_variables 1 end
block the_first_real block ....do the real trials...
|
|
|
Post by AEC on May 5, 2020 10:06:27 GMT
Thank you so much! It works great.
|
|
|
Post by Rex on Jun 18, 2020 14:24:08 GMT
I tried to do just that, @psytoolkit, however when I put in my table the global variable it spits out an error. I tried creating a local variable in the second block and setting it equal to the global variable, but it appears that a local variable errors in a table as well.
How do you recommend putting a counterbalance condition (1, 2, or 3) into a table?
Thank you!
|
|
|
Post by alexandra (AEC) on Jun 18, 2020 16:08:49 GMT
Hi there,
as you experienced, you cannot place a global variable in your table. Instead I recommend setting a local or global variable in accordance with your number refereing to a condition (@column number) and then resume with an if-loop in your task. For example, if the condition number is in the 3rd column
task yourtask set $condition @3 if $condition == 1 show ... ... fi if $condition == 2 ...
I used a local variable in this example. If you need the information of the condition across trials or for the next trial than you will need to use a global variable.
|
|
|
Post by alexandra (AEC) on Jun 18, 2020 16:48:30 GMT
Add-on: May I ask what type your counterbalancing condition is? In my case of setting random variables it was assigning bitmaps to be shown either in a positive, neutral or negative condition. This might help to figure out how to include your conditions, if you want to assign the conditions randomly but evenly to the information in your table.
|
|