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