Home > bioelectromagnetism > eeg_load_scan_dat.m

eeg_load_scan_dat

PURPOSE ^

eeg_load_scan_dat - Read Neuroscan .dat format

SYNOPSIS ^

function [tmptypeeeg, tmprt, tmpresponseeeg, n] = loaddat( FILENAME)

DESCRIPTION ^

 eeg_load_scan_dat - Read Neuroscan .dat format

 usage  [typeeeg, rt, response, n] = loaddat( FILENAME)

 Inputs:
   FILENAME     input Neuroscan .dat file
 Outputs:
     typeeeg        type of the sweeps
    rt        reaction time of the subject
    response    response of the subject
    n        number of sweeps

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [tmptypeeeg, tmprt, tmpresponseeeg, n] = loaddat( FILENAME)
0002 
0003 % eeg_load_scan_dat - Read Neuroscan .dat format
0004 %
0005 % usage  [typeeeg, rt, response, n] = loaddat( FILENAME)
0006 %
0007 % Inputs:
0008 %   FILENAME     input Neuroscan .dat file
0009 % Outputs:
0010 %     typeeeg        type of the sweeps
0011 %    rt        reaction time of the subject
0012 %    response    response of the subject
0013 %    n        number of sweeps
0014 %
0015 
0016 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:33 $
0017 
0018 % Licence:  GNU GPL, no implied or express warranty
0019 % History:  05/2001, arno_delorme@salk.edu
0020 %           - Version 1.0
0021 %
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 
0024 
0025 if nargin<1 
0026     fprintf('Not enought arguments\n'); 
0027     help loaddat 
0028     return;
0029 end;
0030 
0031 BOOL='int16';
0032 ULONG='int32'; 
0033 FLOAT='float32';
0034 
0035 fid=fopen(FILENAME,'r','ieee-le');
0036 if fid<0
0037     fprintf(2,['Error LOADEEG: File ' FILENAME ' not found\n']);  
0038     return;
0039 end;
0040 
0041 % skip the first 20 lines
0042 % -----------------------
0043 for index=1:20    fgetl(fid); end;
0044 
0045 % read the matrix
0046 % ---------------
0047 tmpMat             = fscanf(fid, '%f', [5, inf]);
0048 tmptypeeeg      = tmpMat(3,:);
0049 tmpresponseeeg  = tmpMat(4,:);
0050 tmprt           = tmpMat(5,:) * 1000;
0051 n                = size( tmpMat, 2);
0052 
0053 fclose(fid); 
0054 return;

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003