Adding rows to the eDat file using code
David McFarlane
mcfarla9 at msu.edu
Tue Feb 28 16:29:44 UTC 2012
Sorry for taking so long to get back with a public reply to this one,
by now you probably no longer need the solution. But for the record,
here is some information.
Your code does exactly as it is designed to do. Note that
c.SetAttrib commands do *not* immediately log values, they merely add
attributes to the Context, which may be logged later. Instead, the
c.Log command does the actual logging. By default the enclosing
Procedure issues a c.Log command once at the end of the Procedure
(don't take my word for that, look at the full code generated by
E-Studio), and at that time it logs only the latest value of the
assigned context attributes (e.g., the final values of X & Y). So,
if you do multiple c.SetAttrib of the same attribute within a
Procedure, only the final one will count.
But you can add a row to the log at any time by adding a c.Log
command in inline -- in your case, just add c.Log before the "end if"
of your code fragment. See also the Context.SetAttrib and
Context.Log topics in the E-Basic Help facility.
Now, you might still get an extra row at the end of the Procedure, so
you might have to pull some tricks to get it exactly right (or filter
out extra rows using the filtering facility of E-DataAid,
etc.). Note that you can tell E-Studio to *not* add the c.Log at the
end of a Procedure by changing the LogData property of the Procedure
-- this is a bit tricky, but has been made much easier in EP2.0.10.x.
Alternatively, instead of logging extra rows for each X, Y, you could
add extra columns to hold the data. E.g.,
dim iAttrib as integer
dim x as single, y as single
iAttrib = 0
do
if ASL_GetPOG(x, y, true) then
cnv.Text 20, 20, "Point of gaze from eye tracker"
cnv.Text 20, 40, "x = " & x & " "
cnv.Text 20, 60, "y = " & y & " "
iAttrib = iAttrib + 1
c.setAttrib "textDisplay1.gazePosX" & iAttrib, x
c.setAttrib "textDisplay1.gazePosY" & iAttrib, y
end if
Loop Until TextDisplay1.RT > 0
Now, the single c.Log at the end of the Procedure logs all these
generated attributes/columns.
Finally, remember that PST Web Support at
http://support.pstnet.com/e%2Dprime/support/login.asp also takes
these sorts of questions, and they strive to respond to all requests
in 24-48 hours.
-- David McFarlane
At 1/31/2012 11:00 AM Tuesday, you wrote:
>Hello !
>
>I am using ePrime to display a series of pictures which change with a
>mouseclick. This is working perfectly
>
>I have a coded function that receives data from an external device
>(ASL 504 Pan-Tilt Eyetracker). Everytime the function is run it
>receives an X value and a Y value. I am able to store these values as
>numbers and even display them on screen.
>
>I am trying to run the above function 30 times a second during each
>picture display. I need the eDAT file to have a row for every time it
>is run (30 rows per second). Each row should have the usual stimulus
>related fields plus this X and Y value from my function
>
>Currently in my trial procedure, I have an inline object after the
>picture display and I have this code in it. This is just a simple loop
>that continuously receives the x and y values
>
>[quote]
>
>dim x as single, y as single
>do
>if ASL_GetPOG(x, y, true) then
> cnv.Text 20, 20, "Point of gaze from eye tracker"
> cnv.Text 20, 40, "x = " & x & " "
> cnv.Text 20, 60, "y = " & y & " "
> c.setAttrib "textDisplay1.gazePosX", x
> c.setAttrib "textDisplay1.gazePosY", y
>end if
>Loop Until TextDisplay1.RT > 0
>
>/[quote]
>
>This however just creates one row for each slide and gives me the last
>value of X and Y that has been received. Calling the function at
>regular time intervals inside the inline object does he same thing. I
>am able to create a string and store a long string of these X and Y
>values which I am able to parse through later...but an ideal case for
>me would be to add a row to the eDAT file everytime the function is
>run with X and Y values.
>
>Any help on how to accomplish this would be most helpful. I have a bit
>of programming experience but am extremely new to ePrime.
--
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