Back to the main page.

Bug 2272 - Cannot use ft_read_header for .cnt files

Reported 2013-09-05 14:33:00 +0200
Modified 2019-08-10 12:02:54 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 major
Assigned to:
Depends on:
See also:

Dan - 2013-09-05 14:33:19 +0200

I am trying to use ft_read_header to load .cnt files, but consistently have an error. I updated fieldtrip to the 9/3/13 version, and am still having the problem. On the command line: >>cfg = []; >>cfg.hdr = ft_read_header('101.cnt') ??? Error using ==> read_eep_cnt Too many input arguments. Error in ==> ft_read_header at 661 hdr = read_eep_cnt(filename, 1, 1); I've tried other variants like: cfg.header = ft_read_header('101.cnt') cfg.datafile = '101.cnt'; cfg.header = ft_read_header(cfg) Thanks, Dan

Jörn M. Horschig - 2013-09-05 14:41:03 +0200

Hi Dan, imho this is a problem with 64bit matlab on windows. Could you let us know what Os you are using and what Matlab version (and whether 32bit or 64bit)? I can check then again how I dealt with this (cause I also have cnt files and managed to read them in)

Dan - 2013-09-05 15:01:27 +0200

(In reply to comment #1) Windows 7 64bit, Matlab R2010a 64bit Thanks again, Dan

Jörn M. Horschig - 2013-09-05 15:09:07 +0200

Created attachment 510 mexed read_eep_cnt file for win64 Hi Dan, could you check whether using the attached file works for you? It should go to FieldTrip\trunk\external\eeprobe, where also all other read_eep_cnt files are located

Dan - 2013-09-05 16:23:49 +0200

(In reply to comment #1) Windows 7 64bit, Matlab R2010a 64bit Thanks again, Dan(In reply to comment #3) I copied the file into the eeprobe folder, and it now sits next to read_eep_cnt.mexw32. I am still having the error. Is there something I need to do with the read_eep_cnt.mexw64 file? Thanks, Dan

Jörn M. Horschig - 2013-09-05 16:38:36 +0200

the mexw32 file is for matlab 32bit, the mexw64 bit is for matlab 64bit. if you type in matlab which read_eep_cnt then it show an output pointing to the mexw64 file maybe try typing clear read_eep_cnt and ft_read_header again as long as the which command points to the mexw64 file, it should actually work fine... the error you described comes from the .m file, which is a fallback function in case the mex-file is not found. However, something the fallback m-file was never implemented and just exists for documentation purposed (so that help read_eep_cnt shows some text). please let me know whether you manage to get it to work or not

Dan - 2013-09-05 16:56:14 +0200

(In reply to comment #5) I did not know the .m was a fallback file. My "which" points to the .m file. In fact, it was always doing this (it never pointed to any mexw file). How can I point it to .mexw64? Thanks again, Dan

Jörn M. Horschig - 2013-09-05 17:01:08 +0200

I think the clear command should make matlab look again on its path rather than using the last used file, I am not aware of any other possibility my output looks like this: >> which read_eep_cnt M:\FieldTrip\trunk\external\eeprobe\read_eep_cnt.mexw64 note that I asked for read_eep_cnt and not read_eep_cnt.m (an important difference) did you try the clear statement I pointed to in my last comment? otherwise, try to restart matlab. it should actually work either way... otherwise try putting the mexw64-file anywhere else in your path

Dan - 2013-09-05 17:27:22 +0200

(In reply to comment #7) I restarted Matlab, and from a fresh command line: >> clear all >> clear read_eep_cnt >> which read_eep_cnt C:\Program Files\MATLAB\R2010a\toolbox\fieldtrip-20130903\fieldtrip-20130903\external\eeprobe\read_eep_cnt.m I also tried copying the mexw64 file to the "external" folder, and the "fieldtrip-20130903" folder, but it didn't make a difference. Thanks, Dan

Jörn M. Horschig - 2013-09-06 10:48:31 +0200

hm, that's very strange. Another thing you could try is to delete the .m file and see what happens. And as a last resort, you could try to get Matlab 32bit to read in the data... I am really confused why it does work for you while it does for me

Jörn M. Horschig - 2013-09-06 10:48:56 +0200

(In reply to comment #9) *does not work for you while...

Dan - 2013-09-06 20:36:24 +0200

(In reply to comment #9) Thanks for all the help. I still don't know why it wouldn't work, but I installed a newer version of Matlab (R2011a), and now it's working. Still 64 bit, but now it's seeing the .mexw64 file. Thanks so much, Dan

Jörn M. Horschig - 2013-09-24 15:33:48 +0200

I just added the mexw64 file to the repository, so that everyone can use it.

Robert Oostenveld - 2019-08-10 12:02:54 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on