Welcome! Log In Create A New Profile

Advanced

Tracking Consecutive Correct Trials and Block Transition Automation

Posted by annaipata 
Tracking Consecutive Correct Trials and Block Transition Automation
April 16, 2024 11:31AM
Hi,
My question is whether there is a way to automatically count the number of consecutive correct trials and automatically move to the next block.

The experiment is designed with two alternating blocks. The criterion for moving from one block to the next is based on the animal's performance, specifically achieving 10 consecutive correct trials. So the structure would be as follows: Block 1: after 10 consecutive correct trials move to Block 2: after 10 consecutive correct trials move to Block 1: after 10 consecutive correct trials move to Block 2 and so on.
Could you advise if there is a feature available to count the number of consecutive correct trials automatically and transition between blocks accordingly?
Thank you
Anna
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 16, 2024 12:30PM
If you are using the trialerror function in your timing script, you can get the trial success history from TrialRecord.TrialErrors during the task.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#trialerror
https://monkeylogic.nimh.nih.gov/docs_TrialRecordStructure.html

Then, you can use the trial history to determine whether to switch the block or not in the block selection/change function or userloop function.
https://monkeylogic.nimh.nih.gov/docs_TaskflowControl.html#Blocks
https://monkeylogic.nimh.nih.gov/docs_CreatingTask.html#Userloop
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 16, 2024 01:04PM
Thank you.
In my task I have to track the success history of the blocks, not the single conditions.
Each block consists of 2 conditions presented randomly which are associated with 2 different time scripts: left hand release and right hand release.
(see attachment).
Attachments:
open | download - Task Structure.txt (623 bytes)
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 16, 2024 03:09PM
Did you see the manual pages that I linked? All the information that you need to calculate the number of correct trials in each block is in the TrialRecord structure.
https://monkeylogic.nimh.nih.gov/docs_TrialRecordStructure.html
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 17, 2024 03:17PM
Yes, I did.
I wrote the code to count the number of consectutive correct trials, but not to move to the next block:

TrialRecord.User.consecutiveCorrect = 0;
if TrialRecord.TrialErrors(end) == 0
TrialRecord.User.consecutiveCorrect = TrialRecord.User.consecutiveCorrect + 1;
else
TrialRecord.User.consecutiveCorrect = 0
end
if TrialRecord.User.consecutiveCorrect >= 10
go to block 2” ???????? HOW
end
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 17, 2024 03:50PM
I said you could use the trial history in the block selection function or block change function. Do you understand what they do?

Also, your code does not work because you reset TrialRecord.User.consecutiveCorrect to 0 every time in the very first line. You should have written it like this.
if ~isfield(TrialRecord.User,'consecutiveCorrect'), TrialRecord.User.consecutiveCorrect = 0; end
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 17, 2024 03:59PM
Probably no
And the tutorial is not very easy to read.


I thought this forum was a support forum.
But thank you.
I'll figure it out.
have a nice day
Re: Tracking Consecutive Correct Trials and Block Transition Automation
April 17, 2024 06:10PM
Try the attached task.

If you want to get help, you should at least do your part. You can ask another question if something is not clear in the manual.
Attachments:
open | download - annaipata.zip (5.5 KB)
open | download - example_data.zip (16.8 KB)

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.