Welcome! Log In Create A New Profile

Advanced

TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read

Posted by haoran 
TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read
February 03, 2020 07:00PM
Hi!
I am using ML2 build 199, a conditions file and scene framework with "MultiTarget" adaptor. I want to record the monkey's choice from "ChosenTarget" into a User defined structure "TrialRecord.User.choices".
choice = MultiTarget(eye_);
scene2 = create_scene(choice,[TARGET_LEFT TARGET_RIGHT]);
run_scene(scene2);
if choice.Success
        trialerror(0);  % successful fixation
        goodmonkey(100,'juiceline',1,'numreward', 3,...
            'pausetime', 300);
        TrialRecord.User.choices = choice.ChosenTarget;
        dashboard(1, sprintf('TaskObject#%d chosen', choice.ChosenTarget));
end
The dashboard showed well during the task. But when I load the behavior log with mlread,
[data,MLConfig,TrialRecord,filename,varlist] = mlread
the data(1). UserVars only contains "SkippedFrameTimeInfo". The TrialRecord has choices in the User field, but it only has the information from the last trial.
Could you help me out? Thanks!
Re: TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read
February 03, 2020 09:07PM
I don't know why you think that the variables assigned to TrialRecord.User will be saved in the data file. See the bhv_variable function.
Re: TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read
February 04, 2020 10:16AM
Thank you, that worked perfect.
I was following this example earlier...
example
Re: TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read
February 04, 2020 10:36AM
I don't see any description or indication there that the variables will be saved to the data file.
Hi, I'd like to ask a follow up question here:

I understand that the recommended way to save trial variables is with bhv_variable, but is there a way to access the history of the variables saved this way from TrialRecord?

E.g., if I want to save a boolean value for each trial and on each trial I wanted to print a running "percent true" of that boolean variable, how would I do that? For now, all I can think to do is to save the variable with bhv_variable AND save a running list of the values with TrialRecord.User (or a running percent and number that can be updated analytically).

Thanks!
Re: TrialRecord.User not recorded in data in .bhv2 log file or mlread cannot read
April 24, 2024 06:59PM
No, there isn't. Your computer has limited memory, so it is not reasonable to track the changes of all saved variables. Your example is just one boolean, but some people save huge variables for thousands trials.

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.