Randomise stimuli display on screen Psychtoolbox

I'm trying to set up an experimental script.

One of the response collected are correct or incorrect responses to math equations.

I would like to generate simple addition, multiplication, division math equations with predefined answers and these answers will either be correct or incorrect, to be judged by the participant.

3 equations will appear at once on screen then be judged one by one if it's correct or incorrect

for example: 

3+5 =8 

4+9=12 

1+3=4


At the moment, I've created the cell: 

EasyCorrect = {'3+4=7', '2+12=14', '4+4=8', '5+7=12', '7+8=15', '15-4=11', '18-11=7', '15-5=10', '16-8=8', '13-9=4'};

msize = numel (EasyCorrect)

Easy_Correct = EsayCorrectrandperm(msize, 1))


These commands would randomly select one equation from the EasyCorrect array. 


The problem now is: 

1. how do I display this on screen?

2. how do I display all three sets of equations at the same time? 


Presumable, a function such as this: 


DrawFormattedText(mainwin, char(Easy_Correct), 'Center', 'Center')


But it doesn't work...!!


Any help would be much appreciated


Judging by your example, the first thing you'll have to do is index the Easy_Correct cell array to select out one of the strings representing the equations, e.g.

DrawFormattedText(mainwin, (Easy_Correct{1}, 'Center', 'Center')

Also, are you calling Screen('Flip') after calling DrawFormattedText? Screen('Flip') is the function that actually updates the display.

Sorry if I'm telling you something you already know, but it would be helpful if you included a more of a reproducible example of the code you are running, so people don't have to assume what you are/are not doing.

- Will

On 3/17/2016 5:51 AM, yiling_91@... [PSYCHTOOLBOX] wrote:

I'm trying to set up an experimental script.

One of the response collected are correct or incorrect responses to math equations.

I would like to generate simple addition, multiplication, division math equations with predefined answers and these answers will either be correct or incorrect, to be judged by the participant.

3 equations will appear at once on screen then be judged one by one if it's c orrect o r incorrect

for example:

3+5 =8

4+9=12

1+3=4


At the moment, I've c reated t he cell:

EasyCorrect = {'3+4=7', '2+12=14', '4+4=8', '5+7=12', '7+8=15', '15-4=11', '18-11=7', '15-5=10', '16-8=8', '13-9=4'};

msize = numel (EasyCorrect)

Easy_Correct = EsayCorrectrandperm(msize, 1))


These commands would randomly select one equation from the EasyCorrect array.


The problem now is:

1. how do I display this on screen?

2. how do I display all three sets of equations at the same time?


Presumable, a function such as this:


DrawFormattedText(mainwin, char(Easy_Correct), 'Center', 'Center')


But it doesn't work...!!


Any help would be much appreciated



sorry, typo, it would be DrawFormattedText(mainwin, Easy_Correct{1}, 'Center', 'Center')

- Will

On 3/17/2016 8:58 AM, Will Hopper whopper@... [PSYCHTOOLBOX] wrote:

Judging by your example, the first thing you'll have to do is index the Easy_Correct cell array to select out one of the strings representing the equations, e.g.

DrawFormattedText(mainwin, (Easy_Correct{1}, 'Center', 'Center')

Also, are you calling Screen('Flip') after calling DrawFormattedText? Screen('Flip') is the function that actually updates the display.

Sorry if I'm telling you something you already know, but it would be helpful if you included a more of a reproducible example of the code you are running, so people don't have to assume what you are/are not doing.

- Will

On 3/17/2016 5:51 AM, yiling_91@... [PSYCHTOOLBOX] wrote:

I'm trying to set up an experimental script.

One of the response collected are correct or incorrect responses to math equations.

I would like to generate simple addition, multiplication, division math equations with predefined answers and these answers will either be correct or incorrect, to be judged by the participant.

3 equations will appear at once on screen then be judged one by one if it's c orrect o r incorrect

for example:

3+5 =8

4+9=12

1+3=4


At the moment, I've c reated t he cell:

EasyCorrect = {'3+4=7', '2+12=14', '4+4=8', '5+7=12', '7+8=15', '15-4=11', '18-11=7', '15-5=10', '16-8=8', '13-9=4'};

msize = numel (EasyCorrect)

Easy_Correct = EsayCorrectrandperm(msize, 1))


These commands would randomly select one equation from the EasyCorrect array.


The problem now is:

1. how do I display this on screen?

2. how do I display all three sets of equations at the same time?


Presumable, a function such as this:


DrawFormattedText(mainwin, char(Easy_Correct), 'Center', 'Center')


But it doesn't work...!!


Any help would be much appreciated