Replace data and update file for MEG or EEG This function is used to create/update MEG-MAT or EEG-MAT file with arbitrary signal preprocessing function not supported by VBMEG. [syntax] vb_msrmnt_update_data(inst_spec) [input] inst_spec : <<required>> <struct> instruction spec : fields are as follows: : .org_file : <<required>> measurement file which will be updated : .new_data : <<required>> [n_channel x n_sample] : .channel_type : <<optional>> depend on org_file : : (org_file is MEG) : : ['MEG'] | 'AXIAL' | 'PLANAR' | 'EXTRA' : : (org_file is EEG) : : ['EEG'] | 'EXTRA' : .new_file : <<optional>> if you want to make new file. : : ['org_file'] : : Empty means overwriting '.org_file'. : .bin_data_dir : <<optional>> data stored directory. : : This parameter is valid only when : : '.new_file' field is set. : : [(body of 'new_file')_bin] : : e.g. './new_0123.meg.mat' --> './new_0123_bin' [output] void [note] The size of inst_spec.new_data must be the same as the original one. [history] 2011-02-09 (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 vb_msrmnt_update_data(inst_spec) 0002 % Replace data and update file for MEG or EEG 0003 % 0004 % This function is used to create/update MEG-MAT or EEG-MAT file with arbitrary 0005 % signal preprocessing function not supported by VBMEG. 0006 % 0007 % [syntax] 0008 % vb_msrmnt_update_data(inst_spec) 0009 % 0010 % [input] 0011 % inst_spec : <<required>> <struct> instruction spec 0012 % : fields are as follows: 0013 % : .org_file : <<required>> measurement file which will be updated 0014 % : .new_data : <<required>> [n_channel x n_sample] 0015 % : .channel_type : <<optional>> depend on org_file 0016 % : : (org_file is MEG) 0017 % : : ['MEG'] | 'AXIAL' | 'PLANAR' | 'EXTRA' 0018 % : : (org_file is EEG) 0019 % : : ['EEG'] | 'EXTRA' 0020 % : .new_file : <<optional>> if you want to make new file. 0021 % : : ['org_file'] 0022 % : : Empty means overwriting '.org_file'. 0023 % : .bin_data_dir : <<optional>> data stored directory. 0024 % : : This parameter is valid only when 0025 % : : '.new_file' field is set. 0026 % : : [(body of 'new_file')_bin] 0027 % : : e.g. './new_0123.meg.mat' --> './new_0123_bin' 0028 % 0029 % [output] 0030 % void 0031 % 0032 % [note] 0033 % The size of inst_spec.new_data must be the same as the original one. 0034 % [history] 0035 % 2011-02-09 (Sako) initial version 0036 % 2011-06-01 (Sako) converted return values of vb_load_device to upper case 0037 % 0038 % Copyright (C) 2011, ATR All Rights Reserved. 0039 % License : New BSD License(see VBMEG_LICENSE.txt) 0040 0041 % --- CHECK ARGUMENTS --- % 0042 if ~exist('inst_spec', 'var'), inst_spec = []; end 0043 [inst_spec] = inner_check_arguments(inst_spec); 0044 0045 % --- MAIN PROCEDURE --------------------------------------------------------- % 0046 % 0047 % ----- call appropriate worker 0048 [measurement] = vb_load_device(inst_spec.org_file); 0049 Measurement = upper(measurement); 0050 0051 switch Measurement 0052 case 'MEG' 0053 vb_megfile_update_data(inst_spec); 0054 case 'EEG' 0055 vb_eegfile_update_data(inst_spec); 0056 otherwise 0057 error('(%s) Measurement ''%s'' is not supported', mfilename); 0058 end 0059 0060 return; 0061 % 0062 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0063 0064 % --- INNER FUNCTIONS -------------------------------------------------------- % 0065 % 0066 % --- inner_check_arguments() 0067 % 0068 function [inst_spec] = inner_check_arguments(inst_spec) 0069 func_ = mfilename; 0070 0071 if isempty(inst_spec) 0072 error('(%s) inst_spec is a required parameter', func_); 0073 end 0074 0075 if ~isfield(inst_spec, 'org_file') || isempty(inst_spec.org_file) 0076 error('(%s) inst_spec.org_file is a required field', func_); 0077 end 0078 0079 if exist(inst_spec.org_file, 'file') ~= 2 0080 error('(%s) cannot find inst_spec.org_file : %s', func_); 0081 end 0082 0083 if ~isfield(inst_spec, 'new_data') || isempty(inst_spec.new_data) 0084 error('(%s) inst_spec.new_data is a required field', func_); 0085 end 0086 return; 0087 % 0088 % --- end of inner_check_arguments() 0089 % 0090 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0091 0092 % --- END OF FILE --- %