Fill an array from an (unreferenced) list?

liwenna liwenna at gmail.com
Wed Aug 5 12:26:49 UTC 2009


I had a REAL long post but then realised that your question can
actually be answered much simpler.

Below is part of the filling code. It filles level 3 and 4 of the
triallist (so trialpair 3 and 4 that are trials 5/6 and 7/8 as there
are two trials (prime and probe) to each trialpair. Triallist
therefore consists of 4 attirubtes primedistractor, primetarget,
probedistractor and probetarget, to gain control over 2 consecutive
'trials' (two slides prime and probe on the trialproc). Poswords,
neutwords and negwords are the names of the three arrays." Triallist
setattrib 3 " refers to the 3rd level of triallist.

'Fill level 3 of Triallist (negative control)
	TrialList.SetAttrib 3, "primedistractor", poswords(3)
	Triallist.setattrib 3, "primetarget", poswords(4)

	Triallist.setattrib 3, "probedistractor", neutwords(2)
	Triallist.setattrib 3, "probetarget", negwords(3)


'Fill level 4 of Triallist (negative experimental)
	TrialList.SetAttrib 4, "primedistractor", negwords(4)
	Triallist.setattrib 4, "primetarget", poswords(5)

	Triallist.setattrib 4, "probedistractor", neutwords(3)
	Triallist.setattrib 4, "probetarget", negwords(5)

It's really very simple, although it's a bit of a hassle to type it
all out (should be able to automate it... ) but yet it's far more
simple than the version I received from someone else who had done all
the randomizing by hand.

Thanks again for your help Peter!

Best regards,

liwenna





On Aug 5, 11:13 am, Peter Quain <pqu... at une.edu.au> wrote:
> good, i hadn't run that code. there should be no timing problems
> because of the import routine - that is all going on before your
> trial procedure starts, i gather, so been and gone by the time
> important things are afoot.
>
> Can you post how you go about populating list from array, if you have
> the time? ta
>
> At 07:08 PM 5/08/2009, you wrote:
>
> >The script works just fine Peter!
>
> >(only the s$ was not allowed but simply replacing it by a normal word
> >does the trick)
>
> >Thanks so much!
>
> >Now the timing question remains.... anyone experience with that?
>
> >On Aug 4, 12:44 pm, liwenna <liwe... at gmail.com> wrote:
> > > 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