<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="FR"><div class="WordSection1"><p class="MsoNormal">Dear fieldtrip users, </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">I want to import my BioSemi files (.bdf format) for several subjects.</p><p class="MsoNormal">The files have the same structure (almost same length and same triggers) as they were recoded for identical exepriment protocol.</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">I’ve implemented the processing (time-locked and time-frequency analysis) on 1 set of data.</p><p class="MsoNormal">The code to read the bdf file work fine as my markers, channels,length of data, etc. are ok. </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">However, I can’t process all my subjects as some .bdf file can’t be opened. </p><p class="MsoNormal">Below is an extract of my code for reading the .bdf files. <o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">******************************</p><p class="MsoNormal" style="text-indent:35.4pt"><i> dataset  = fullfile(path_Biosemi, 'AV-Exp2'  , 'P1.bdf');<o:p></o:p></i></p><p class="MsoNormal" style="text-indent:35.4pt"><i>% ** READ FILE INFO<o:p></o:p></i></p><p class="MsoNormal"><i>               % read the header information and the events from the data<o:p></o:p></i></p><p class="MsoNormal"><i>               hdr                 =   ft_read_header(dataset)<o:p></o:p></i></p><p class="MsoNormal"><i>                % Config<o:p></o:p></i></p><p class="MsoNormal"><i>                cfg= [];<o:p></o:p></i></p><p class="MsoNormal"><i>                cfg.dataset         =   dataset;<o:p></o:p></i></p><p class="MsoNormal"><i>               cfg.hdr=hdr;<o:p></o:p></i></p><p class="MsoNormal"><i>    <o:p></o:p></i></p><p class="MsoNormal"><i>               % **RE-REFERENCES<o:p></o:p></i></p><p class="MsoNormal"><i>               cfg.reref           =   'yes';<o:p></o:p></i></p><p class="MsoNormal"><i>                cfg.refchannel      =   {'EXG3', 'EXG4'} ; % electrode 131/132 // cell-array with new EEG reference channel(s), this can be 'all' for a common average reference<o:p></o:p></i></p><p class="MsoNormal"><i>                cfg.refmethod       =   'avg'; % 'avg', 'median', or 'bipolar' for bipolar derivation of sequential channels (default = 'avg')<o:p></o:p></i></p><p class="MsoNormal"><i>               % ** TRIAL DEFINITION<o:p></o:p></i></p><p class="MsoNormal"><i>               cfg.channel=[1:128];<o:p></o:p></i></p><p class="MsoNormal"><i>               event_All           =   ft_read_event(cfg.dataset);<o:p></o:p></i></p><p class="MsoNormal">******************************</p><p class="MsoNormal" align="center" style="text-align:center"><o:p> </o:p></p><p class="MsoNormal">The <i>ft_read_header</i> works perfectly for all my .bdf files. However, for some of them the <i>ft_read_event</i> does not work and returns this error : </p><p class="MsoNormal"> </p><p class="MsoNormal"><i>Error in read_biosemi_bdf>readLowLevel (line 283)<o:p></o:p></i></p><p class="MsoNormal"><i>  buf = read_24bit(filename, offset, numwords);<o:p></o:p></i></p><p class="MsoNormal"><i><o:p> </o:p></i></p><p class="MsoNormal"><i>Error in read_biosemi_bdf (line 254)<o:p></o:p></i></p><p class="MsoNormal"><i>      buf = readLowLevel(filename, offset, epochlength); % see below in subfunction<o:p></o:p></i></p><p class="MsoNormal"><i><o:p> </o:p></i></p><p class="MsoNormal"><i>Error in ft_read_data (line 409)<o:p></o:p></i></p><p class="MsoNormal"><i>    dat = read_biosemi_bdf(filename, hdr, begsample, endsample, chanindx);<o:p></o:p></i></p><p class="MsoNormal"><i><o:p> </o:p></i></p><p class="MsoNormal"><i>Error in ft_read_event (line 345)<o:p></o:p></i></p><p class="MsoNormal"><i>    sdata = ft_read_data(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', begsample, 'endsample',<o:p></o:p></i></p><p class="MsoNormal"><i>    endsample, 'chanindx', schan);<o:p></o:p></i></p><p class="MsoNormal"><i><o:p> </o:p></i></p><p class="MsoNormal"><i><o:p> </o:p></i></p><p class="MsoNormal">I’ve checked the .bdf files on the BioSemi sotware and they are ok. So files are not corrupted. And they were recorded with the same procedure as for files that work with fieldtrip.</p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">I’ve tried to go deeper in the Matlab code for <i>read_24bit</i> function but I can’t find out the solution.</p><p class="MsoNormal">Does anyone have any idea, or already encountered this problem ? </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">Thanks for your help, </p><p class="MsoNormal">Marion </p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><b><span style="color:#2F5597">Marion VINCENT</span></b><span style="color:black"><br>Eng., PhD , CNRS Research Engineer<br><b>Tel</b>: +33 607 59 46 76<br><br>Laboratoire SCALab UMR CNRS 9193<br>Université Lille 3<br>BP 60149<br>59653 Villeneuve d'Ascq Cedex<br><i>http://scalab.cnrs.fr</i><br>--------------------------------------------<br>L’Imaginarium / SCV-IrDIVE Equipex<br>99a Boulevard Descat<br>59200 Tourcoing<br><i>http://www.irdive.fr</i>/</span><o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p></div></body></html>