Creating list or vector with numerical values & getting n-th element out of this list


Author
Message
Olga Kunina
Olga Kunina
Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)
Group: Forum Members
Posts: 4, Visits: 1

Hi Dave,


 thank you
very much for your quick answer.  I have
followed your suggestions and changed my code as follows:


 <trial
igtfeedback>


   / ontrialbegin
= [ if (trial.igt.response == "deck1") { [..]


    values.loss
= getitem(counter.deck1_loss, values.cards_deck1); [..] }]


 </trial>


 Unfortunately
it does not work. It seems to be a problem with the expression "getitem(counter.deck1_loss,
values.cards_deck1)".


 I have
uploaded the script. Thanks a lot for taking time to answer the questions,


Best regards,


Olga


Attachments
IowaGamblingTask_final.exp (1.3K views, 8.00 KB)
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: 109K

Hmm, glancing over the code you posted, I think


/ getlossdeck1
= getitem(counter.deck1_loss.items, values.cards_deck1)


should be changed to a /ontrialend or /ontrialbegin expression:


<values>
/ getlossdeck1 = 0
[...]
</values>


and then


<trial sometrial>
/ ontrialbegin = [values.getlossdeck1=getitem(counter.deck1_loss, values.cards_deck1]
[...]
</trial>


If that doesn't do the trick, you might want to attach your script to this thread (-> see 'Options' tab when posting a reply).


~Dave


Olga Kunina
Olga Kunina
Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)
Group: Forum Members
Posts: 4, Visits: 1

Hi everyone,


I am trying
to expand the source code for the IOWA-Gambling task available at the Inquisit
website. In this version the loss-values are selected randomly as follows:


 <expressions>


/ getlossdeck1
= noreplace(0, 0, 0, 0, 0, 150, 200, 250, 300, 350) 


</expressions>


By contrast,
I want to define a fixed sequence of loss values for loss values for each trail.
I want to choose the current value depending on how many cards were already
taken from the deck. Speaking more technically - I want to get the nth element
out of an array, vector or list with numerical values.


Therefore I
am trying to define something like a list or a vector with loss values (integer
values) for each trail.


 / loss_deck1
= (0, 0, 0, 0, 0, 150, 200, 250, 300, 350) 


 Since that
did not work I have defined a counter


 <counter
deck1_loss>


/ items = (0,
0, 0, 0, 0, 150, 200, 250, 300, 350)


/ select = sequence(1-10)


</counter>


 Additionally,
I have introduced a variable "values.cards_deck1" that counts how
often deck1 was chosen. This counter is updated in each trial.


In the last
step I try to define the loss value for the current trial as:


/ getlossdeck1
= getitem(counter.deck1_loss.items, values.cards_deck1)


But each
time I get the error message "Expression is not valid. Item not found".


Does
someone have an idea whether it is possible to create a list or vector with
numerical values & get back a specific element out of this list?


Thanks a
lot for your help in advance.


Best regards, 


Olga Kunina


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search