Welcome! Log In Create A New Profile

Advanced

BHV2 and character encoding

Posted by Jaewon 
BHV2 and character encoding
December 22, 2021 02:08PM
Update your NIMH ML to the most recent version before trying this tip.

BHV2 files that were recorded with NIMH ML 2.0 earlier than the Apr 15, 2019 version may not be readable on your new computer, if the character set of the system is not the same as when the files were created. Such a case includes when you try to read them:

1) in MATLAB R2020a or later
2) with a later version of NIMH ML (e.g., v2.2)
3) on the operating system of a different language or platform (e.g., localized Windows or Linux)

It is because your BHV2 files contain non-alphabetical characters and their encoding does not match with the system's. To fix it, type the following two lines on the MATLAB command window before reading the files. You need to know the encoding scheme of your previous system.
setpref('NIMH_MonkeyLogic','DefaultEncoding','windows-1252')  % See fopen for all available encoding schemes
setpref('NIMH_MonkeyLogic','MachineFormat','ieee-le')

If the above method fixes the issue, then you may want to convert the files to the newer version of BHV2 permanently. It takes time, so try it only when you have just a small number of files.
convert_format('bhv2')
See the function manual for more information.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#convert_format

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.