Using a counter to draw from a list


Author
Message
nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
So i have say this list:
<list a2optiono1>
/ items = (70 100)
</list>

And this counter:
<counter a2option>
/ items = (1;2)
/ select = noreplace
</counter>


How do I call list.a2optiono1.(x) where x is counter.a2option.currentvalue or nextvalue?

Thanks for any help.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
#1: You should not use a <counter> at all. Use only <list> elements.
#2:

<values>
/ myvalue = 0
</values>

<list a2optiono1>
/ items = (70, 100)
</list>

<list a2option>
/ items = (1, 2)
</list>

<block myblock>
/ trials = [1-2=mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [values.myvalue=list.a2optiono1.item(list.a2option.nextvalue)]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.myvalue%>")
</text>

(I admittedly have trouble seeing a realistic use case for this; it strikes me as unnecessarily complicated)

nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
I have an experiment with 16  buttons. Randomly assigned to each one of those buttons are 16 different gambles that have two outcomes that occur at different probabilities. What I really need is randomly matched arrays but I know inquisit cant do arrays.



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
<list> elements are very much like arrays.

nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
I just cant figure it out. I need say an array list whatever that is (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16).

I then need to say shuffle that array so they arent in order. Then I need to grab position 1 and assign to several different things, then position 2 and assign that to several different things. How do I do this with a list or counter or anything?
nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
/ onblockbegin = [values.o1a = list.a2optiono1.(x1);values.o1b = list.a2optiono2.(x1);values.o2a = list.a2optiono1.(x2);values.o2b = list.a2optiono2.(x2); values.o1p = list.a2optionp.(x1); values.o2p = list.a2optionp.(x2); ]

So like above where I need each x1 or x2 or x16 to be a different number drawn from 1-16 without replacement.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
The /selectionmode is what "shuffles" your list. You can just pull out items randomly from it and assign.

<values>
/ a1 = 0
/ a2 = 0
/ b1 = 0
/ b2 = 0
</values>

<block myblock>
/ trials = [1=mytrial]
</block>

<list mylist>
/ poolsize = 16
/ selectionmode = random
/ selectionrate = always
</list>

<trial mytrial>
/ ontrialbegin = [values.a1=list.mylist.nextindex; values.a2=list.mylist.currentindex;
    values.b1=list.mylist.nextindex; values.b2=list.mylist.currentindex; ]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.a1%>, <%values.a2%>, <%values.b1%>, <%values.b2%>")
</text>

Or you can "shuffle" the thing once, store that result in another list / array and then grab your values in order:

<block myblock>
/ onblockbegin = [list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex);
    ]
/ trials = [1=mytrial]
</block>

<list mylist>
/ poolsize = 16
/ selectionmode = random
/ selectionrate = always
</list>

<list mylist_shuffled>
</list>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%list.mylist_shuffled.item(1)%>, <%list.mylist_shuffled.item(2)%>, <%list.mylist_shuffled.item(3)%>, ...")
</text>

It all depends on what exactly you want to do.

Edited 9 Years Ago by Dave
nashby
nashby
Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)Guru (8.8K reputation)
Group: Forum Members
Posts: 78, Visits: 159
So i can call something like List.xxx.item(<%list.mylist_shuffled.item(1)%>)? Doesnt seem to work?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
That's broken syntax. If you use proper syntax, that works just fine:

<list a>
/ items = ("C", "A", "B")
</list>

<list b>
/ items = (1,2,3)
</list>

<trial mytrial>
/ ontrialbegin = [values.myvalue = list.a.item(list.b.item(1))]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.myvalue%>")
</text>

<values>
/ myvalue = ""
</values>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
> / onblockbegin = [values.o1a = list.a2optiono1.(x1);values.o1b = list.a2optiono2.(x1);values.o2a = list.a2optiono1.(x2);values.o2b > = list.a2optiono2.(x2); values.o1p = list.a2optionp.(x1); values.o2p = list.a2optionp.(x2); ]
>
> So like above where I need each x1 or x2 or x16 to be a different number drawn from 1-16 without replacement.                               

See the 1st example I posted in my previous reply: https://www.millisecond.com/forums/FindPost15614.aspx

All you need is a single <list> with /selectionrate set to 'always'. nextindex forces a new selection, currentindex does not (same for nextvalue and currentvalue).

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search