output of jsPsych.data.getLastTrialData() #359
Unanswered
SSchwoebel
asked this question in
Q&A
Replies: 2 comments
-
The data module has been overhauled for version 6. To check if key_press has a particular value, you can use this command: jsPsych.data.getLastTrialData().values()[0].key_press Or, equivalently jsPsych.data.get().last(1).values()[0].key_press There is some documentation in the /docs/markdown_docs/features_data.md file in the repo. Until version 6 is officially released, the docs on the website will still be for version 5. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you very much! This works. This issue can be closed |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm using the function jsPsych.data.getLastTrialData() as
var mydata = jsPsych.data.getLastTrialData()
to get the key press from the last trial, in order to use it in the conditional function of the next. I was using an older version of jsPsych until recently. I updated it now, but since then this doesn't work anymore. mydata seems to be an object now, which doesn't have any sensible attributes (I used to check if data.key_press had a certain value). Here the output from the debugging console:
mydata
Object { push: DataCollection/data_collection.push(), join: DataCollection/data_collection.join(), top: DataCollection/data_collection.top(), first: DataCollection/data_collection.first(), last: DataCollection/data_collection.last(), values: DataCollection/data_collection.values(), count: DataCollection/data_collection.count(), readOnly: DataCollection/data_collection.readOnly(), addToAll: DataCollection/data_collection.addToAll(), addToLast: DataCollection/data_collection.addToLast(), 8 more… }
In order to exclude my code as the reason, I tried this out in the example jspsych-animation.html with adding the above line; this leads to the same error.
I'm not sure how to solve this. I'm aware that I could check for this at the end of the previous trial, but then I would have to rewrite large parts of my code.
Thanks!
Sarah Schwoebel
Beta Was this translation helpful? Give feedback.
All reactions