Home > functions > device > meg > vb_megfile_load_coordtype.m

vb_megfile_load_coordtype

PURPOSE ^

read coordinate type from MEG-MAT file

SYNOPSIS ^

function [coordtype] = vb_megfile_load_coordtype(megfile)

DESCRIPTION ^

 read coordinate type from MEG-MAT file
 [usage]
   [coordtype] = vb_megfile_load_coordtype(megfile)
 [input]
   megfile : <required> <<file>> MEG-MAT file
 [output]
   coordtype : <<string>> coordinate type e.g. 'SPM_Right_M'
             :  If MEG-MAT file does not have any appropriate field, 
             :  return empty.
             :  If MEG-MAT file is invalid, return 'BAD_MEG_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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [coordtype] = vb_megfile_load_coordtype(megfile)
0002 % read coordinate type from MEG-MAT file
0003 % [usage]
0004 %   [coordtype] = vb_megfile_load_coordtype(megfile)
0005 % [input]
0006 %   megfile : <required> <<file>> MEG-MAT file
0007 % [output]
0008 %   coordtype : <<string>> coordinate type e.g. 'SPM_Right_M'
0009 %             :  If MEG-MAT file does not have any appropriate field,
0010 %             :  return empty.
0011 %             :  If MEG-MAT file is invalid, return 'BAD_MEG_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('megfile', 'var'), megfile = ''; end
0022 [megfile] = inner_check_arguments(megfile);
0023 
0024 % --- MAIN PROCEDURE --------------------------------------------------------- %
0025 %
0026 if isempty(megfile)
0027   coordtype = 'BAD_MEG_FILE';
0028   return;
0029 end
0030 
0031 load(megfile, 'CoordType');
0032 if exist('CoordType', 'var')
0033   coordtype = CoordType;
0034 else
0035   fprintf('(%s)MEG-MAT file (%s) does not have coordinate type field\n', ...
0036     mfilename, megfile);
0037   coordtype = '';
0038 end
0039 return;
0040 %
0041 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0042 
0043 % --- INNER FUNCTIONS -------------------------------------------------------- %
0044 %
0045 % --- inner_check_arguments()
0046 %
0047 function [megfile] = inner_check_arguments(megfile)
0048 func_ = mfilename;
0049 if isempty(megfile)
0050   fprintf('(%s)megfile is invalid\n', func_);
0051   return;
0052 end
0053 
0054 if exist(megfile, 'file') ~= 2
0055   fprintf('(%s)cannot find megfile : %s\n', func_, megfile);
0056   megfile = '';
0057   return;
0058 end
0059 return;
0060 %
0061 % --- end of inner_check_arguments()
0062 %
0063 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0064 
0065 %%% END OF FILE %%%

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005