String as array name?

Kerwin Olfers kerwino at gmail.com
Fri Feb 7 22:34:28 UTC 2014


Hi David, 

Thanks for your reply! And you are totally right, multiple-dimension array 
is the right way to go. 
Can't believe I normally work in Matlab and didn't think of that... 






On Friday, 7 February 2014 18:11:17 UTC+1, McFarlane, David wrote:
>
> Um, I am missing something here.  Why not use an ordinary 
> multiple-dimension array to hold all the answers to all the questions, 
> e.g., 
>
>      Const  nQuestions as Integer = 4 
>      Const  nAnswersMax as Integer = 10 
>      Dim Answers( nQuestions, nAnswersMax ) 
>
> and then just use an array index to get the answers for the selected 
> question?  If you need to get fancier, you might use a User Defined 
> Type (akin to Structures or Records in other programming languages, 
> look it up in the E-Basic Help facility), perhaps using an array of your 
> UDTs. 
>
> To answer your initial question, if you study the Rte, RteCollection, 
> and related topics in the E-Basic Help, you just might devise a way 
> to manage *object* variables with arbitrary names from strings, but 
> still not manage ordinary variables.  Even then, I think it generally 
> best to adapt techniques according to the tools at hand, which brings 
> me back to ordinary multiple-dimension arrays in VBA/E-Basic. 
>
> ----- 
> 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) PST's trained staff 
> take any and all questions at https://support.pstnet.com , and they 
> strive to respond to all requests in 24-48 hours, so make full use of 
> it.  3) In addition, PST offers several instructional videos on their 
> YouTube channel (http://www.youtube.com/user/PSTNET ).  4) 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 2/7/2014 11:02 AM Friday, Kerwin Olfers wrote: 
> >I was wondering if there is a way to take a string from an attribute 
> >and use it as a variable/array name in inline? 
> > 
> >My situation: 
> > 
> >Participants are prompted with a questions and asked to type their 
> >answer (which is displayed using the echo functions). 
> >There are multiple correct answers per question. I know in Eprime 
> >2.0.10 and up you can simple have the multiple answer 
> ><http://www.pstnet.com/support/kb.asp?TopicID=1400>comma separated 
> >in an attribute list, which would solve all my problems. 
> >However we're running 2.0.8 with little hope of updating in the near 
> future. 
> > 
> >The solution so far is to store the multiple answers for each 
> >question in separate arrays. 
> > 
> >e.g. 
> >question1(1) = "dog" 
> >question1(2) = "labrador" 
> >question2(1) = "fish" 
> >question2(2)=  "tuna" 
> > 
> >Then after the question slide, I use an inline to run through the 
> >array to check if the answer is correct. 
> >However, since there is a different array for each question, I need 
> >a way to select the proper array, which hopefully doesn't involve me 
> >putting a whole list of 'if' statements. 
> > 
> >Something like: 
> > 
> >For Counter = 1 to Ubound(c.getAttrib("arrayName")) 
> >    If c.getAttrib("arrayName")(Counter) = Stimulus.RESP then 
> >       Stimulus.ACC = 1 
> >    end if 
> >next 
> > 
> >.. although the above obviously doesn't work in the current form. 
> >Does anyone know of a way to do this, i.e. use strings stored in 
> >attributes as variable names in inline (a bit like an eval function)? 
> > 
> >Thanks! 
>
>

-- 
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/801e2848-7e1e-4645-8542-4488b2f716d5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20140207/5502ab81/attachment.htm>


More information about the Eprime mailing list