Back to the main page.

Bug 2125 - File not close in read_biosemi_bdf.m

Status CLOSED FIXED
Reported 2013-04-18 21:10:00 +0200
Modified 2013-10-26 18:00:46 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Guillaume - 2013-04-18 21:10:50 +0200

It seems that a file is not closed after being read through read_biosemi_bdf.m. This was noticed by running fopen('all') after using fileio.


Jan-Mathijs Schoffelen - 2013-05-07 08:48:17 +0200

Yes, it seems that fopen is called twice (once in the main function body, once in a subfunction), but fclose is only called once. I guess it makes sense to pass the file identifier to the subfunction to avoid fopening the file each time the subfunction is called. Alternatively, adding an fclose ad the end of the main function body would do the trick. Shall we vote?


Jan-Mathijs Schoffelen - 2013-05-09 14:36:23 +0200

read_edf also has this issue. added fclose(EDF.FILE.FID) in read_edf and read_biosemi_bdf in revision 8119