Home > functions > device > meg > vb_meginfo_get_valid_data_bit_len.m

vb_meginfo_get_valid_data_bit_len

PURPOSE ^

return valid data bit length by following the priority rule

SYNOPSIS ^

function [bit_len] = vb_meginfo_get_valid_data_bit_len(meg_info, init_swt)

DESCRIPTION ^

 return valid data bit length by following the priority rule

 [usage]
   [bit_len] = vb_meginfo_get_valid_data_bit_len(meg_info, init_swt)

 [input]
   meg_info : <required> <<struct>> MEG header information
   init_swt : <optional> initialize switch true or [false]
            :  if this is true, force into reloading

 [output]
    bit_len : data bit length

 [note]
   (priority rule) : data_bit_len field > from data_file > default
   <default> value is 12 for now because old MEGinfo may not have necessary
   fields which are in order to determine value.
   This is used getYkgwHdrCalib function internally.

   See also
     vb_meginfo_load_data_bit_len
     getYkgwHdrCalib

 [history]
   2007-06-12 (Sako) initial version
   2010-02-04 (Sako) reformatted if statement to erace warinings

 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 [bit_len] = vb_meginfo_get_valid_data_bit_len(meg_info, init_swt)
0002 % return valid data bit length by following the priority rule
0003 %
0004 % [usage]
0005 %   [bit_len] = vb_meginfo_get_valid_data_bit_len(meg_info, init_swt)
0006 %
0007 % [input]
0008 %   meg_info : <required> <<struct>> MEG header information
0009 %   init_swt : <optional> initialize switch true or [false]
0010 %            :  if this is true, force into reloading
0011 %
0012 % [output]
0013 %    bit_len : data bit length
0014 %
0015 % [note]
0016 %   (priority rule) : data_bit_len field > from data_file > default
0017 %   <default> value is 12 for now because old MEGinfo may not have necessary
0018 %   fields which are in order to determine value.
0019 %   This is used getYkgwHdrCalib function internally.
0020 %
0021 %   See also
0022 %     vb_meginfo_load_data_bit_len
0023 %     getYkgwHdrCalib
0024 %
0025 % [history]
0026 %   2007-06-12 (Sako) initial version
0027 %   2010-02-04 (Sako) reformatted if statement to erace warinings
0028 %
0029 % Copyright (C) 2011, ATR All Rights Reserved.
0030 % License : New BSD License(see VBMEG_LICENSE.txt)
0031 
0032 % --- CHECK ARGUMENTS --- %
0033 if ~exist('meg_info', 'var'), meg_info = []; end
0034 if ~exist('init_swt', 'var'), init_swt = []; end
0035 [meg_info, init_swt] = inner_check_arguments(meg_info, init_swt);
0036 
0037 % --- MAIN PROCEDURE --------------------------------------------------------- %
0038 %
0039 
0040 % --- FORCE INTO RELOADING
0041 if init_swt
0042   bit_len = vb_meginfo_load_data_bit_len(meg_info);
0043   if ~isempty(bit_len)
0044     return;
0045   end
0046 end
0047 
0048 % --- CONSTANTS
0049 DEFAULT_BIT_LEN = 12;
0050 
0051 % --- PRIORITY #1
0052 bit_len = vb_meginfo_get_data_bit_len(meg_info);
0053 if ~isempty(bit_len)
0054   return;
0055 end
0056 
0057 % --- PRIORITY #2
0058 bit_len = vb_meginfo_load_data_bit_len(meg_info);
0059 if ~isempty(bit_len)
0060   return;
0061 end
0062 
0063 % --- PRIORITY #3
0064 bit_len = DEFAULT_BIT_LEN;
0065 return;
0066 %
0067 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0068 
0069 
0070 % --- INNER FUNCTIONS -------------------------------------------------------- %
0071 %
0072 % --- inner_check_arguments()
0073 %
0074 function [meg_info, init_swt] = inner_check_arguments(meg_info, init_swt)
0075 
0076 func_ = mfilename;
0077 
0078 if isempty(meg_info)
0079   error('(%s)meg_info is a required parameter', func_);
0080 end
0081 
0082 if isempty(init_swt)
0083   init_swt = false;
0084 end
0085 return;
0086 %
0087 % --- end of inner_check_arguments()
0088 %
0089 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0090 
0091 % --- END OF FILES --- %

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