Back to the main page.

Bug 1849 - second output argument not initialized for read_ctf_cls

Reported 2012-11-26 11:44:00 +0100
Modified 2014-03-12 12:21:44 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jörn M. Horschig
Depends on:
See also:

Jörn M. Horschig - 2012-11-26 11:44:29 +0100

Error in ==> fileio\private\read_ctf_cls at 25 condNumbers = []; ??? Output argument "condLabels" (and maybe others) not assigned during call to "M:\FieldTrip\trunk\fileio\private\read_ctf_cls.m>read_ctf_cls". Error in ==> ft_read_event at 489 [condNumbers,condLabels] = read_ctf_cls(classfile); Independently of the question why the hell I suddenly get this error, I realized that this is causing ft_trialfin_general to return an empty matrix, because ft_read_event fails (and there is a try catch surrounding the ft_read_event_call) Simple solution: init the output arguments in read_ctf_cls as empty. This was done once but then commented out - any reason why? I wonder though why it all worked on Friday and today it does not (I am working using my local repository and did not update today).

Jörn M. Horschig - 2012-11-26 15:12:26 +0100

I see why it was uncommented - because it does lead to some other errors. condLabels needs to be initialized as an empty cell matrix {} not as an empty array [], then it works fine. The initial error occurs when the ClassFile.cls of a dataset is empty. Initializing with {} seems to work fine in both cases, when the cls-file is empty and when it has regular content.

Jörn M. Horschig - 2012-11-28 17:51:07 +0100

svn ci fileio/private/read_ctf_cls.m -m "bugfix-#1849-second output argument initialized if not before returning" Sending fileio/private/read_ctf_cls.m Transmitting file data . Committed revision 7047.