Home > bioelectromagnetism > cnt_open.m

cnt_open

PURPOSE ^

cnt_open - function to handle various eeg_load commands

SYNOPSIS ^

function [p] = cnt_open(p,parent)

DESCRIPTION ^

 cnt_open - function to handle various eeg_load commands
 
 Usage: [p] = cnt_open(p,[parentgui])
 
 p is a parameter structure. See eeg_toolbox_defaults for more 
 information on this parameter structure.
 
 In this function, p must contain the fields:
 
 p.cnt.path - the directory location of the file to load
 p.cnt.file - the name of the file to load
 p.cnt.type - the file format string, one of:
 
 'Scan4x'
 'Scan3x'

 These are the only CNT file types currently supported. 
 See functions eeg_load* for details.
 
 The most important return value is the CNT data in 
 p.cnt.  If the file format is scan4x, various 
 parameters are returned also.
 
 See also: EEG_LOAD, EEG_LOAD_ASCII, EMSE_READ_AVG,
           EEG_LOAD_SCAN4_CNT, EEG_LOAD_SCAN3_CNT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p] = cnt_open(p,parent)
0002 
0003 % cnt_open - function to handle various eeg_load commands
0004 %
0005 % Usage: [p] = cnt_open(p,[parentgui])
0006 %
0007 % p is a parameter structure. See eeg_toolbox_defaults for more
0008 % information on this parameter structure.
0009 %
0010 % In this function, p must contain the fields:
0011 %
0012 % p.cnt.path - the directory location of the file to load
0013 % p.cnt.file - the name of the file to load
0014 % p.cnt.type - the file format string, one of:
0015 %
0016 % 'Scan4x'
0017 % 'Scan3x'
0018 %
0019 % These are the only CNT file types currently supported.
0020 % See functions eeg_load* for details.
0021 %
0022 % The most important return value is the CNT data in
0023 % p.cnt.  If the file format is scan4x, various
0024 % parameters are returned also.
0025 %
0026 % See also: EEG_LOAD, EEG_LOAD_ASCII, EMSE_READ_AVG,
0027 %           EEG_LOAD_SCAN4_CNT, EEG_LOAD_SCAN3_CNT
0028 %
0029 
0030 % $Revision: 1.1 $ $Date: 2004/11/12 01:30:25 $
0031 
0032 % Licence:  GNU GPL, no express or implied warranties
0033 % History:  10/2003, Darren.Weber_at_radiology.ucsf.edu
0034 %                    created
0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0036 
0037 if ~exist('p','var'),[p] = eeg_toolbox_defaults; end
0038 
0039 eegversion = '$Revision: 1.1 $';
0040 fprintf('CNT_OPEN [v %s]\n',eegversion(11:15)); tic;
0041 
0042 
0043 [path,name,ext] = fileparts(strcat(p.cnt.path, filesep, p.cnt.file));
0044 file = fullfile(path,[name ext]);
0045 
0046 if ~isequal(exist(file),2),
0047   lookfile = which(file);
0048   if isempty(lookfile),
0049     msg = sprintf('...cannot locate %s\n', file);
0050     error(msg);
0051   else
0052     file = lookfile;
0053   end
0054 end
0055 
0056 type = lower(p.cnt.type)
0057 
0058 switch type,
0059   
0060   case 'scan4x_cnt',
0061     
0062     p.cnt = eeg_load_scan4_cnt(file);
0063     
0064   case 'scan3x_cnt',
0065     
0066       msg = sprintf('...failed to load scan3.x datafile: %s\n',file);
0067       error(msg);
0068       
0069   otherwise,
0070     msg = sprintf('\nPlease specify data type: Scan4x_cnt | Scan3x_cnt\n\n');
0071     error(msg);
0072 end
0073 
0074 
0075 t = toc; fprintf('...done (%6.2f sec).\n\n',t);
0076 
0077 return

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