Welcome! Log In Create A New Profile

Advanced

"mlread" failing to read files

Posted by jamesbutler01 
"mlread" failing to read files
February 21, 2022 09:32AM
I have a task that works fine in MonkeyLogic. I normally import the .bhv file into my Matlab analysis script using your provided "mlread" function without any problems. However, when trying to import my latest two experiments, it throws the below error. Any ideas on how to fix this?

I am on NIMH MonkeyLogic 2 (2.0.205 Feb 3 2020), running on Matab R2019b on Windows 11 machine with good specs. The .bhv files are linked below:
File 1
File 2

An error occurred while reading the variable, 'ÿÿÿÿÿ[truncated but this character was repeated ~thousands of times]ÿÿÿÿÿÿ... Output truncated. Text exceeds maximum line length for Command Window display.
An error occurred while reading the variable, 'ÿÿÿÿÿ[truncated but this character was repeated ~thousands of times]ÿÿÿÿÿÿ... Output truncated. Text exceeds maximum line length for Command Window display.
Error using fieldnames
Invalid input argument of type 'double'. Input must be
a structure or a Java or COM object.

Error in mlconfig/update (line 202)
            if exist('s','var'), for
            m=mlsetdiff(fieldnames(obj),fieldnames(s))',
            s.(m{1}) = obj.(m{1}); end, obj = s; end  %
            for mlread

Error in mlread (line 26)
if 1<nargout, MLConfig =
update(mlconfig,fid.read('MLConfig')); end

Error in import_SnakeDiscreteMaze_withML (line 94)
[ml_data,MLConfig,TrialRecord,filepath,varlist] =
mlread(ml_filename);
Re: "mlread" failing to read files
February 21, 2022 01:43PM
Are you sure that they are the data files? They look like junks created by some disk recovery tool. The first file is absolutely nothing and the second one is 10 different file pieces fused together.
Re: "mlread" failing to read files
February 21, 2022 02:27PM
These are what was saved by monkeylogic, which I transferred to a USB stick and then to my laptop. They are an appropriate filesize for the session (~1 hour) so presumably do contain the data. I think I am using the latest version of your mlread, but the task was run on an older version of monkeylogic, so maybe it could be a compatibility issue between versions?

For reference, here is another .bhv file created by the exact same task which works fine with mlread. The only difference between the file is I ran different conditions, so some of the TrialRecord variables would be slightly different, but I don't see how that could have caused the files to be corrupted. Are there certain things we shouldn't attach to the TrialRecord?

Bhv 3
Re: "mlread" failing to read files
February 21, 2022 04:58PM
I do not think it is how NIMH ML saves the data. It is your disk or USB. Run the error checking tool on your disks.

You can tell the problem of the files even by reading them with Notepad. Your first file is filed with 0xFF from the beginning to the end.

The first recognizable trial number in your second file is 156. Then, after Trial 167, the number goes back to Trial 116. A similar pattern is repeated several times.

If you think the different conditions cause the problem, just save a couple of trials for a test and try reading the data file.
Re: "mlread" failing to read files
February 22, 2022 05:14AM
Apologies Jaewon, it appears the USB drive broke on the day we changed the condition. Hence I mistakenly thought it was an issue with my ML script. Sorry to have wasted your time, and thanks for the help anyway!

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.