Fill an array from an (unreferenced) list?
liwenna
liwenna at gmail.com
Tue Aug 4 10:44:25 UTC 2009
Thank you for your quick reply Peter!
I will definitely try your suggestion! I never used external files to
feed info into e-prime so that's a nice thing to 'get my hands on'.
However: doesn't the use of external files influence timing?
(anyone?). And if so: would this also be the case if the whole
retrieveing of info is done in the beginning of a blockproc BEFORE the
trials start running (i.e. in my set-up combined with your/Peter's
suggestion, arrays would be filled, randomised and used to fill a
triallist BEFORE each block of trials starts running).
I think I won't have time to try it before tomorrow but I'll post back
when succesfull (and also when not actually ;) )
Thanks again!
liwenna
On Aug 4, 12:03 pm, Peter Quain <pqu... at une.edu.au> wrote:
> If you want flexibility and to avoid finicky typing, perhaps you could:
> - type the words in text documents, 1 word to a line. you have
> seperate arrays for each stimulus type ... and you need to type the
> stim sometime
> - open the text documents to read, 1 at a time
> - run a loop, reading each line of the document and saving it as the
> string in each cell of your array
>
> Something like this would allow lists of differing length to be read in.
> ...
> ' for 0 option base
> Dim YourArray() As String
> Dim s$ As String
> Dim LineCount As Integer
> Dim n As Integer
>
> ' Find out the number of lines
> Open "YOURFILE.txt" For Input As #1
> LineCount = -1
> Do While Not EOF(1)
> LineCount = LineCount + 1
> Input #1, s$
> Loop
> Close #1
>
> ' make the array the size of the document...
> ReDim YourArray(LineCount)
>
> ' Read in the stimuli
> Open "YOURFILE.txt" For Input As #1
> For n = 0 To LineCount
> Input #1, YourArray(n)
> Next n
> Close #1
>
> At 07:13 PM 4/08/2009, you wrote:
>
> >Hi all!
>
> >I got something....
>
> >Does anyone know how to fill an array with words from an
> >(unreferenced) list???
>
> >Elaborated background info:
> >I'm working on a NAP task which demands control over two pairs of
> >stimuli in consecutive trials. I.E. a prime trial may show a negative
> >distractorword and a negative targetword and is followed by a probe
> >trial that shows a neutral distractorword and a positive targetword.
> >To put it differently: each trials consists of 2 displays with 4
> >stimuli in total and control over which type of word (pos neg neutral)
> >appears in which position is needed. Moreover... blocks of trial
> >(pairs) are repeated and the stimuliwords need to be randomized each
> >time.
>
> >I got this all working by using arrays. I got separate arrays for
> >negative, positive and neutral words and at the beginning of each
> >block these 3 arrays are randomised and then used to fill a triallist.
> >The trialpair described above for instance is one level in this list
> >that has four attributes (primetarget = negarray(0) primedistractor =
> >negarray(1), probetarget = posarray(0) and probedistractor = neutarray
> >(0), etc etc, with one level per trialpair.
>
> >So far so good.... but now about filling the arrays... in my testsetup
> >I filled the arrays by typing out each word in the array-inline for
> >instance:
>
> >negarray(0) = "negword1"
> >negarray(1) = "negword2"
> >etc
>
> >This works fine but it means that each single word in every list has
> >to be written out in the inline and completed with " " at the start
> >and beginning. As I like my setups to be 'versatile' and easy to
> >adjust for later use I would think it to be more elegant (and less of
> >a pain in adding " -wise) if the stimuliwords could more simply be
> >pasted in to an (unreferenced) list and the arrays being filled from
> >these lists.... but I can't get this to work.... I tried it with
> >colon notation and unreferenced lists ( negarray(0) = [negative:0] and
> >with getattrib/setattrib setattrib ( "negarray(0)", [negative:0] as
> >well as negarray(0) = getattrib ([negative:0]) ), both in all kinds of
> >bracket-arrangements and with the list that contains the attribute
> >'negative' placed in different locations (trashthing, sessionproc,
> >blockproc, trialproc etc) but to no avail....
>
> >I'm just hoping that I'm majorly overlooking something and/or that
> >someone just happens to know how to do this. The task is working fine
> >as it is, I just think it would be more elegant if the arrays could be
> >filled from lists. Or could this perhaps be another instance of colon-
> >notation not working properly?
>
> >Best regards,
>
> >liwenna
--~--~---------~--~----~------------~-------~--~----~
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