set sensor label to calibinfo struct [usage] [calib_info] = vb_calibinfo_set_sensor_label(calib_info, label) [input] calib_info : <optional> <<struct>> MEGinfo.calib_info : This field is not a standard field of MEGinfo. : This is used only when importing data label : <optional> {n_ch x 1} : If this is not specified or empty, default labels will be : applied. {'0', '1', '2', ... '(n_ch-1)'} [output] calib_info : updated one [note] [history] 2011-07-04 (Sako) initial version
0001 function [calib_info] = vb_calibinfo_set_sensor_label(calib_info, label) 0002 % set sensor label to calibinfo struct 0003 % 0004 % [usage] 0005 % [calib_info] = vb_calibinfo_set_sensor_label(calib_info, label) 0006 % 0007 % [input] 0008 % calib_info : <optional> <<struct>> MEGinfo.calib_info 0009 % : This field is not a standard field of MEGinfo. 0010 % : This is used only when importing data 0011 % label : <optional> {n_ch x 1} 0012 % : If this is not specified or empty, default labels will be 0013 % : applied. {'0', '1', '2', ... '(n_ch-1)'} 0014 % 0015 % [output] 0016 % calib_info : updated one 0017 % 0018 % [note] 0019 % 0020 % [history] 0021 % 2011-07-04 (Sako) initial version 0022 0023 % --- CHECK ARGUMENTS --- % 0024 if ~exist('calib_info', 'var'), calib_info = []; end 0025 if ~exist('label', 'var'), label = []; end 0026 [calib_info, label] = inner_check_arguments(calib_info, label); 0027 0028 % --- MAIN PROCEDURE --------------------------------------------------------- % 0029 % 0030 calib_info.sensor_label = label; 0031 % 0032 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0033 0034 0035 % --- INNER FUNCTIONS -------------------------------------------------------- % 0036 % 0037 % --- inner_check_arguments() 0038 % 0039 function [calib_info, label] = inner_check_arguments(calib_info, label) 0040 func_ = mfilename; 0041 if isempty(calib_info) 0042 % sensor_label will be added 0043 % error('(%s) calib_info is a required parameter', func_); 0044 end 0045 0046 if isempty(label) 0047 n_ch = length(calib_info.sensitivity); 0048 label = 0:(n_ch-1); 0049 end 0050 if size(label, 1) == 1 0051 % transpose to [n_ch x 1] 0052 label = label'; 0053 end 0054 return; 0055 % 0056 % --- end of inner_check_arguments() 0057 % 0058 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0059 0060 % --- END OF FILE --- %