FIFF_WRITE_RAW_SEGMENT_TIMES Write chunck of raw data to disk [] = FIFF_WRITE_RAW_SEGMENT_TIMES(FNAME, RAW, FROM, TO, SEL) The functions reads data from a file specified by raw which is obtained with fiff_setup_read_raw fname - the name of the file where to write raw - structure returned by fiff_setup_read_raw from - starting time of the segment in seconds to - end time of the segment in seconds sel - optional channel selection vector drop_small_buffer - optional bool to say if the last data buffer is dropped to make sure all buffers have the same size (required by maxfilter) buffer_size_sec - float (size of data buffers in seconds)
0001 function fiff_write_raw_segment_times(fname, raw, from, to, sel, drop_small_buffer, buffer_size_sec) 0002 % FIFF_WRITE_RAW_SEGMENT_TIMES Write chunck of raw data to disk 0003 % [] = FIFF_WRITE_RAW_SEGMENT_TIMES(FNAME, RAW, FROM, TO, SEL) 0004 % 0005 % The functions reads data from a file specified by raw 0006 % which is obtained with fiff_setup_read_raw 0007 % 0008 % fname - the name of the file where to write 0009 % raw - structure returned by fiff_setup_read_raw 0010 % from - starting time of the segment in seconds 0011 % to - end time of the segment in seconds 0012 % sel - optional channel selection vector 0013 % drop_small_buffer - optional bool to say if the last data buffer is dropped 0014 % to make sure all buffers have the same size 0015 % (required by maxfilter) 0016 % buffer_size_sec - float (size of data buffers in seconds) 0017 0018 % 0019 % Author : Alexandre Gramfort, MGH Martinos Center 0020 % License : BSD 3 - clause 0021 % 0022 0023 global FIFF; 0024 if isempty(FIFF) 0025 FIFF = fiff_define_constants(); 0026 end 0027 % 0028 me = 'MNE:fiff_write_raw_segment'; 0029 % 0030 if nargin < 2 0031 error(me, 'Incorrect number of arguments'); 0032 end 0033 if nargin < 3 | isempty(from) 0034 from = raw.first_samp / raw.info.sfreq; 0035 end 0036 if nargin < 4 | isempty(to) 0037 to = raw.last_samp / raw.info.sfreq; 0038 end 0039 if nargin < 5 0040 sel = 1:raw.info.nchan; 0041 end 0042 if nargin < 6 0043 drop_small_buffer = false; 0044 end 0045 if nargin < 7 0046 buffer_size_sec = 25; 0047 end 0048 0049 buffer_size = ceil(buffer_size_sec * raw.info.sfreq); 0050 0051 % 0052 % 0053 % Convert to samples 0054 % 0055 from = floor(from * raw.info.sfreq); 0056 to = ceil(to * raw.info.sfreq); 0057 0058 fiff_write_raw_segment(fname, raw, from, to, sel, drop_small_buffer, buffer_size);