string comparison


Author
Message
Jens Bölte
Jens Bölte
Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)
Group: Forum Members
Posts: 78, Visits: 60
Hello,

I am programming a dot-probe experiment. Probes will be "F" or "J" and appear either on the left or the right side of the screen. I like to check for the correctness of the answer which I tried to achieve in the following manner.

<text probe.right>
/ items = ("F","F","F","F","F","F","F","J","J","J","J","J","J","J","F","F","F","F","F","F","F","J","J","J","J","J","J","J")
/ select = noreplace
</text>

<trial t.pos.word.right>
/ ontrialbegin = [if (list.posi.probe.pos.right.nextvalue == 1) {text.probe.right.hposition = values.links; values.pos = values.links}
                                                            else {text.probe.right.hposition = values.rechts; values.pos = values.rechts}]
/ ontrialbegin = [if (text.probe.right.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
/ stimulusframes = [ 1 = fixation; 30 = maske; 31 = pos.word.right.tar, pos.word.right.dis; 42 = maske; 43 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [trial.t.pos.word.right.response == values.korrekt]
/ timeout = 3000
</trial>

However, values.korrekt evaluates always to 36 probably because "if(text.probe.right.nextvalue == "F") is always wrong. Suggestions are welcome.

Best wishes Jens



Jens Bölte
Jens Bölte
Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)
Group: Forum Members
Posts: 78, Visits: 60
Hello,

I keep on finding a solution. The following seems to work:

<list probe.right.l>
/ items = ("F", "J")
/ poolsize = 14
</list>

<trial t.pos.word.right>
/ ontrialbegin = [if (list.posi.probe.pos.right.nextvalue == 1) {text.probe.right.hposition = values.links; values.pos = values.links}
                                                            else {text.probe.right.hposition = values.rechts; values.pos = values.rechts}]
/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
/ stimulusframes = [ 1 = fixation; 30 = maske; 31 = pos.word.right.tar, pos.word.right.dis; 42 = maske; 43 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [trial.t.pos.word.right.response == values.korrekt]
/ timeout = 3000
</trial>

Am I mistaken?

Best wishes Jens

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
For stimulus elements (<text>, <picture>, etc.) the nextvalue property is identical to the nextindex property. I.e., what it returns is not the item ("F", "J"), but the item's numerical index (e.g. 1 for the 1st item listed, 17 for the 17th, etc.). Hence your check

/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}

necessarily fails and values.korrekt is always set to 36.

Only in for <list> elements do nextvalue and nextindex reflect different things.

Jens Bölte
Jens Bölte
Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)
Group: Forum Members
Posts: 78, Visits: 60
So,

/ ontrialbegin = [if (list.probe.right.l.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}
as well as
/ ontrialbegin = [if (text.probe.right.nextvalue == "F") {values.korrekt = 33} else {values.korrekt = 36}]
fail?
Best Jens

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
No. As I said in my previous response, nextvalue does what you want in case of <list> elements. It returns the item, not the index number. nextindex returns the index.

Another way to fix your code is to use the <text>'s currentitem property in /iscorrectresponse.


<text probe.right>
/ items = ("F","F","F","F","F","F","F","J","J","J","J","J","J","J","F","F","F","F","F","F","F","J","J","J","J","J","J","J")
/ select = noreplace
</text>

<trial t.pos.word.right>
/ stimulusframes = [ 1 = probe.right]
/ validresponse = ("F", "J")
/ iscorrectresponse = [if (text.probe.right.currentitem == "F") {values.korrekt = 33} else {values.korrekt = 36}; trial.t.pos.word.right.response == values.korrekt]
</trial>

<values>
/ korrekt = ""
</values>

<block myblock>
/trials = [1-28 = t.pos.word.right]
</block>



Jens Bölte
Jens Bölte
Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)Guru (9.5K reputation)
Group: Forum Members
Posts: 78, Visits: 60
Hello,

thank a lot. I misunderstood your first reply.

Best Jens.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search