Home > bioelectromagnetism > eeg_load_scan4_cnt.m

eeg_load_scan4_cnt

PURPOSE ^

eeg_load_scan4_cnt - Load a scan4.1+ CNT file

SYNOPSIS ^

function cnt = eeg_load_scan4_cnt(filename,channels,range)

DESCRIPTION ^

 eeg_load_scan4_cnt - Load a scan4.1+ CNT file
 
 cnt = eeg_load_scan4_cnt('filename',channels,range)
 
 filename   -  Filename string
 channels   -  see eeg_load_scan4_cnt_data,
               default is 'all' channels (sensors/electrodes)
 range      -  see eeg_load_scan4_cnt_data,
               1x2 start/stop sample points
               eg, [1 1000] loads first 1000 points

               NOTE: default range is [1 1000], not
               all of the CNT file!  If you want it all,
               specify 'all'

 cnt        -  struct, see eeg_load_scan4_cnt_data

 See also: eeg_load_scan4_cnt_data, eeg_load_scan4_cnt_event

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cnt = eeg_load_scan4_cnt(filename,channels,range)
0002 
0003 % eeg_load_scan4_cnt - Load a scan4.1+ CNT file
0004 %
0005 % cnt = eeg_load_scan4_cnt('filename',channels,range)
0006 %
0007 % filename   -  Filename string
0008 % channels   -  see eeg_load_scan4_cnt_data,
0009 %               default is 'all' channels (sensors/electrodes)
0010 % range      -  see eeg_load_scan4_cnt_data,
0011 %               1x2 start/stop sample points
0012 %               eg, [1 1000] loads first 1000 points
0013 %
0014 %               NOTE: default range is [1 1000], not
0015 %               all of the CNT file!  If you want it all,
0016 %               specify 'all'
0017 %
0018 % cnt        -  struct, see eeg_load_scan4_cnt_data
0019 %
0020 % See also: eeg_load_scan4_cnt_data, eeg_load_scan4_cnt_event
0021 %
0022 
0023 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:33 $
0024 
0025 % Licence:  GNU GPL, no implied or express warranties
0026 % History:  06/2002, Darren.Weber_at_radiology.ucsf.edu
0027 %                    created
0028 %           10/2003, Darren.Weber_at_radiology.ucsf.edu
0029 %                    modified default range
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031 
0032 if ~exist('filename','var'),
0033     msg = sprintf('EEG_LOAD_SCAN4_CNT: No filename provided\n');
0034     error(msg);
0035 end
0036 
0037 if ~exist('channels','var'), channels = 'all'; end
0038 
0039 if ~exist('range','var'), range = [1 1000]; end
0040 
0041 [path,name,ext] = fileparts(filename);
0042 filename = fullfile(path,[name ext]);
0043 
0044 if ~isequal(exist(filename),2),
0045     lookfile = which(filename);
0046     if isempty(lookfile),
0047         msg = sprintf('Cannot locate %s\n', filename);
0048         error(msg);
0049     else
0050         filename = lookfile;
0051     end
0052 end
0053 
0054 fprintf('EEG_LOAD_SCAN4_CNT: Reading file: %s\n',filename);
0055 
0056 fid = fopen(filename,'r','ieee-le');
0057 
0058 [cnt.volt,cnt.srate,cnt.numSamples,cnt.labels,cnt.events] = eeg_load_scan4_cnt_data(fid,channels,range);
0059 
0060 cnt.path = [path,filesep];
0061 cnt.file = [name,ext];
0062 
0063 fclose(fid);
0064 
0065 return

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