Comparing Strings
Susan G. Campbell
scampbell at casl.umd.edu
Tue Aug 5 15:53:45 UTC 2008
Hi David,
I think you'll want to use c.GetAttrib("EmotionPerceived") rather than
EmotionPerceived in your logical test there -- it looks like you're
setting an attribute in those earlier if statements, not assigning a
variable.
HTH,
Susan
-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On
Behalf Of David
Sent: Tuesday, August 05, 2008 11:38 AM
To: E-Prime
Subject: Re: Comparing Strings
Thank you for your response. I changed it to:
If Cstr(EmotionPerceived) = Cstr(c.GetAttrib("Emotion")) Then
NameEmotion.ACC = 1
Else
NameEmotion.ACC = 0
End If
And still no luck. If it helps, please see below for my complete
inline:
Thanks again,
David
Dim EmotionPerceived As String
If NameEmotion.RESP = "p" Then Goto jump1
If c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 1 And c.GetAttrib ("Label1")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 2 And c.GetAttrib ("Label2")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 3 And c.GetAttrib ("Label3")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 4 And c.GetAttrib ("Label4")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 5 And c.GetAttrib ("Label5")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 6 And c.GetAttrib ("Label6")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7") =
c.GetAttrib ("Text1") Then
c.SetAttrib "EmotionPerceived", "Anger"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text2") Then
c.SetAttrib "EmotionPerceived", "Sad"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text3") Then
c.SetAttrib "EmotionPerceived", "Surprise"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text4") Then
c.SetAttrib "EmotionPerceived", "Disgust"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text5") Then
c.SetAttrib "EmotionPerceived", "Neutral"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text6") Then
c.SetAttrib "EmotionPerceived", "Happy"
ElseIf c.GetAttrib ("NameEmotion.Resp") = 7 And c.GetAttrib ("Label7")
= c.GetAttrib ("Text7") Then
c.SetAttrib "EmotionPerceived", "Fear"
End If
If Cstr(EmotionPerceived) = Cstr(c.GetAttrib("Emotion")) Then
NameEmotion.ACC = 1
Else
NameEmotion.ACC = 0
End If
On Aug 5, 11:24 am, "Helen Tibboel" <hftibb... at gmail.com> wrote:
> Hello,
> Are you sure that both strings are actually read as strings? You can
convert
> an expression using the "CStr" function.
> Kind regards,
> Helen
>
> On 8/5/08, David <ddiod... at gmail.com> wrote:
>
>
>
>
>
> > Hello,
>
> > I am trying to compare two strings, and mark correct answers as 1
and
> > incorrect as 0. This is my inline:
>
> > If EmotionPerceived = c.GetAttrib("Emotion") Then
> > NameEmotion.ACC = 1
>
> > Else
> > NameEmotion.ACC = 0
>
> > End If
>
> > I have a similar inline in a different eprime and it seems to work
> > fine. It is almost like this one doesn't even register. It compiles
> > fine, but does not change the NameEmotion.ACC value in the edat
file.
>
> > Any help is much appreciated,
>
> > David
>
> --
> "I had a beautiful signature in those days, intricate, oriental,
illegible,
> with a mighty slashing underscore, a signature more complex than that
of the
> great Hackmuth."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en
-~----------~----~----~----~------~----~------~--~---
More information about the Eprime
mailing list