Home > eeg > egis > meg_code > rd_meg_allch.m

rd_meg_allch

PURPOSE ^

trialdata = rd_meg_allch(fid,header_length,NChan,numsamp,start_samp);

SYNOPSIS ^

function trialdata = rd_meg_allch(fid,header_length,NChan,numsamp,start_samp);

DESCRIPTION ^

trialdata = rd_meg_allch(fid,header_length,NChan,numsamp,start_samp);
meg
reads in meg data from .meg file.  Can be used in two ways 
 one way is to read from an arbitrary start point in samples, start_samp
    a total of numsamp samples. 
       in this case file_position is set to 'bof' on calls 
 the other way is to sequentially read the blocks in which case the 
  read starts at the beginning of the file in blocks of numsamp 
    in thsi case file_position i to 'cof';
fid must be a valid header;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function trialdata = rd_meg_allch(fid,header_length,NChan,numsamp,start_samp);
0002 %trialdata = rd_meg_allch(fid,header_length,NChan,numsamp,start_samp);
0003 %meg
0004 %reads in meg data from .meg file.  Can be used in two ways
0005 % one way is to read from an arbitrary start point in samples, start_samp
0006 %    a total of numsamp samples.
0007 %       in this case file_position is set to 'bof' on calls
0008 % the other way is to sequentially read the blocks in which case the
0009 %  read starts at the beginning of the file in blocks of numsamp
0010 %    in thsi case file_position i to 'cof';
0011 %fid must be a valid header;
0012 %
0013 %
0014 
0015 if ~(nargin == 4|nargin == 5);
0016     error('improper number of input arguments')
0017 end;
0018 
0019 
0020 if nargin == 5
0021     frewind(fid);
0022     fseek(fid,header_length,'bof');
0023     skip_bytes = NChan*(start_samp-1)*4;
0024     fseek(fid,skip_bytes,'cof');
0025 end;
0026 trialdata  = fread(fid,[NChan,numsamp],'real*4');
0027 trialdata = trialdata';                                       
0028 
0029 
0030 
0031 
0032

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003