read coordinate type from EEG-MAT file [usage] [coordtype] = vb_eegfile_load_coordtype(eegfile) [input] eegfile : <required> <<file>> EEG-MAT file [output] coordtype : <<string>> coordinate type e.g. 'SPM_Right_M' : If EEG-MAT file does not have any appropriate field, : return empty. : If EEG-MAT file is invalid, return 'BAD_EEG_FILE' for now [note] [history] 2008-04-01 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [coordtype] = vb_eegfile_load_coordtype(eegfile) 0002 % read coordinate type from EEG-MAT file 0003 % [usage] 0004 % [coordtype] = vb_eegfile_load_coordtype(eegfile) 0005 % [input] 0006 % eegfile : <required> <<file>> EEG-MAT file 0007 % [output] 0008 % coordtype : <<string>> coordinate type e.g. 'SPM_Right_M' 0009 % : If EEG-MAT file does not have any appropriate field, 0010 % : return empty. 0011 % : If EEG-MAT file is invalid, return 'BAD_EEG_FILE' for now 0012 % [note] 0013 % 0014 % [history] 0015 % 2008-04-01 (Sako) initial version 0016 % 0017 % Copyright (C) 2011, ATR All Rights Reserved. 0018 % License : New BSD License(see VBMEG_LICENSE.txt) 0019 0020 % --- CHECK ARGUMENTS --- % 0021 if ~exist('eegfile', 'var'), eegfile = ''; end 0022 [eegfile] = inner_check_arguments(eegfile); 0023 0024 % --- MAIN PROCEDURE --------------------------------------------------------- % 0025 % 0026 if isempty(eegfile) 0027 coordtype = 'BAD_EEG_FILE'; 0028 return; 0029 end 0030 0031 eeginfo = vb_eegfile_load_eeginfo(eegfile); 0032 if isempty(eeginfo) 0033 fprintf('(%s)eegfile (%s) does not have eeginfo\n', ... 0034 mfilename, eegfile); 0035 coordtype = 'BAD_EEG_FILE'; 0036 else 0037 if isfield(eeginfo, 'CoordType') 0038 coordtype = eeginfo.CoordType; 0039 else 0040 fprintf('(%s)EEG-MAT file (%s) does not have coordinate type field\n', ... 0041 mfilename, eegfile); 0042 coordtype = ''; 0043 end 0044 end 0045 return; 0046 % 0047 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0048 0049 % --- INNER FUNCTIONS -------------------------------------------------------- % 0050 % 0051 % --- inner_check_arguments() 0052 % 0053 function [eegfile] = inner_check_arguments(eegfile) 0054 func_ = mfilename; 0055 if isempty(eegfile) 0056 fprintf('(%s)eegfile is invalid\n', func_); 0057 return; 0058 end 0059 0060 if exist(eegfile, 'file') ~= 2 0061 fprintf('(%s)cannot find eegfile : %s\n', func_, eegfile); 0062 eegfile = ''; 0063 return; 0064 end 0065 return; 0066 % 0067 % --- end of inner_check_arguments() 0068 % 0069 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0070 0071 %%% END OF FILE %%%