Array-Voodoo
David McFarlane
mcfarla9 at msu.edu
Thu Sep 11 16:43:29 UTC 2014
Benny,
You did not say what version of E-Prime you used, or whether you got
this error at compile-time or run-time. But just for fun, I pasted
your code into an inline and could not get any error using either EP
1.2 or 2.0.10.353 (although I did have to add a Dim statement for the
RandomObject variable in order to avoid a "Variable not defined"
error at compile time).
That said, I have a couple of bones to pick with you...
First and foremost (and Michiel Spape is waiting to see me weigh in
on this :) ), please, please, never ever use While...Wend!! Instead,
use the much superior Do...Loop. You may see my statement on that at
https://groups.google.com/d/topic/e-prime/JXcYIfRPWVE .
Next, although your While statement is technically correct, adding
extra parentheses to your conditional expression could greatly
clarify matters for the reader and remove any ambiguity about how the
program should interpret it. Thus (and substituting the superior Do
for that awful While, and using the "_" line continuaton character to
break the logical line into two physical lines),
Do While ( (EndArray(RandomObject,4,1) = "1") And _
(EndArray(RandomObject,4,2) = "1") ) ' both are completed
...
Regards,
-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (https://twitter.com/EPrimeMaster)
/----
Stock reminder: 1) I do not work for PST. 2) You may reach PST's
trained staff (and other support facilities) at
https://support.pstnet.com . 3) If you do get an answer from PST
staff, please extend the courtesy of posting their reply back here
for the sake of others.
\----
At 9/10/2014 04:50 PM Wednesday, Benny Liebold wrote:
>Hi,
>I've by now reached a point at which I have no clue what's going on.
>Basically, I wrote some script for an E-Prime Experiment to select
>the stimuli to display. I used arrays to represent the stimuli,
>because the have categories from which they have be dran randomly
>and then checked, if the violate the mode of stimulus selection. So
>first, I declared my array at the beginning of the Experiment:
>
>Dim EndArray(14,5,2) As String
>
>The Array contains 14 Items that each have 5 attributes and are
>going to be 2 times, so these are the array dimensions. I decided to
>just ignore array space "0" not to get lost in the script later on.
>Now, in a later script E-Prime is told to randomly select on of 14
>items and repeat this process until
>
>'determine destination
>
>RandomObject = random(1,14)
>
>
>'Destination already covered 2 times?
>
>While EndArray(RandomObject,4,1) = "1" And
>EndArray(RandomObject,4,2) = "1" 'both are completed
>
>RandomObject = random(1,14) 'draw again
>
>Wend
>
>This very easy condition check produces the following error - but I
>have no clue why. Why is it regarding the array as a function
>instead of a variable? I used this type of addressing arrays in
>other experiments and it worked ...
>
>"Unknown function EndArray"
>
>I am aware that my code ist not beautiful at all, but it works most
>of the time ;)
>
>I would be glad, if you could help!
>
>Regards
>Benny
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/5411d136.6594320a.4398.2393SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/d/optout.
More information about the Eprime
mailing list