add history information to EEGinfo [usage] new_EEGinfo = vb_eeginfo_add_history(EEGinfo, this_history) [input] EEGinfo : <required> EEGinfo that will be updated this_history : <required> added story of execution (string) [output] new_EEGinfo : new EEGinfo [note] [history] 2006-11-22 (Sako) initial version 2011-05-27 (Sako) modified according to the new data format Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function new_EEGinfo = vb_eeginfo_add_history(EEGinfo, this_history) 0002 % add history information to EEGinfo 0003 % [usage] 0004 % new_EEGinfo = vb_eeginfo_add_history(EEGinfo, this_history) 0005 % [input] 0006 % EEGinfo : <required> EEGinfo that will be updated 0007 % this_history : <required> added story of execution (string) 0008 % [output] 0009 % new_EEGinfo : new EEGinfo 0010 % [note] 0011 % 0012 % [history] 0013 % 2006-11-22 (Sako) initial version 0014 % 2011-05-27 (Sako) modified according to the new data format 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 vb_define_device; 0020 0021 % --- CHECK ARGUMENT --- % 0022 if ~exist('EEGinfo', 'var'), EEGinfo = []; end 0023 if ~exist('this_history', 'var'), this_history = []; end 0024 [EEGinfo, this_history] = inner_check_argument(EEGinfo, this_history); 0025 0026 % --- MAIN PROCEDURE --------------------------------------------------------- % 0027 % 0028 if isempty(this_history) 0029 % do nothing 0030 return; 0031 end 0032 0033 new_EEGinfo = EEGinfo; 0034 new_history = sprintf('[%s] %s', datestr(now), this_history); 0035 0036 if isfield(new_EEGinfo, 'device_info') 0037 if ~isfield(new_EEGinfo.device_info, 'History') 0038 his_len = 0; 0039 else 0040 his_len = size(new_EEGinfo.device_info.History, 2); 0041 end 0042 end 0043 new_EEGinfo.device_info.History{his_len+1} = new_history; 0044 return; 0045 % 0046 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0047 0048 % --- INNER FUNCTIONS -------------------------------------------------------- % 0049 % 0050 % --- inner_check_argument() 0051 % 0052 function [EEGinfo, this_history] = inner_check_argument(EEGinfo, this_history) 0053 func_ = mfilename; 0054 if isempty(EEGinfo) 0055 error('(%s)EEGinfo is required', func_); 0056 end 0057 return; 0058 % 0059 % --- end of inner_check_argument() 0060 0061 %--- END OF FILE ---%