ztree

ztree loaded table: How to match variables


I am trying to match data in an experiment, created through individual input, to a payoff structure that is stored in a txt I have (successfully) loaded into zTree before. However, I do not know, how to find the - in specific - payoff to the corresponding input in the txt file that is defined there.

The txt file looks as follows: NK table screenshot

Within the game, the "Input" variable is generated by users and now the payoff needs to be found corresponding to the input generated. Can anyone help out here?

Thanks a lot in advance!


Solution

  • TABLENAME.find(condition, variable) function retrieves the first value that fits a condition.

    Assuming the user has the variable MyInput in the subjects table, this program running on subjects would do the trick:

    NKtable.find(Input == :MyInput, Payoff)