Home > vbmeg > functions > device > eeg > vb_eegfile_remake_for_LF.m

vb_eegfile_remake_for_LF

PURPOSE ^

make lightweight eeg.mat file for calculating leadfield

SYNOPSIS ^

function vb_eegfile_remake_for_LF(src_file, dst_file)

DESCRIPTION ^

 make lightweight eeg.mat file for calculating leadfield
 [usage]
¡¡¡¡vb_eegfile_remake_for_LF(src_file, dst_file)
 [input]
   src_file : <required> source EEG-MAT file
   dst_file : <optional> output file ['<src_path>/<src_name>.pos.eeg.mat']
 [output]
   none
 [note]
   output file can be used as a template file the purpose of which is only
   updating position
   @see vb_posfile_remake_datafile.m
   This output EEG-MAT file is valid only for calculating lead field
 [history]
   2010-03-03 (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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_eegfile_remake_for_LF(src_file, dst_file)
0002 % make lightweight eeg.mat file for calculating leadfield
0003 % [usage]
0004 %¡¡¡¡vb_eegfile_remake_for_LF(src_file, dst_file)
0005 % [input]
0006 %   src_file : <required> source EEG-MAT file
0007 %   dst_file : <optional> output file ['<src_path>/<src_name>.pos.eeg.mat']
0008 % [output]
0009 %   none
0010 % [note]
0011 %   output file can be used as a template file the purpose of which is only
0012 %   updating position
0013 %   @see vb_posfile_remake_datafile.m
0014 %   This output EEG-MAT file is valid only for calculating lead field
0015 % [history]
0016 %   2010-03-03 (Sako) initial version
0017 %   2011-06-01 (Sako) converted return values of vb_load_device to upper case
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 % --- CHECK ARGUMENTS --- %
0023 if ~exist('src_file', 'var'), src_file = ''; end
0024 if ~exist('dst_file', 'var'), dst_file = ''; end
0025 [src_file, dst_file] = inner_check_arguments(src_file, dst_file);
0026 
0027 % --- MAIN PROCEDURE --------------------------------------------------------- %
0028 %
0029 [measurement] = vb_load_device(src_file);
0030 Measurement = upper(measurement);
0031 org_EEGinfo = vb_load_measurement_info(src_file);
0032 
0033 % --- copy minimum set to calculate leadfield
0034 EEGinfo.Device        = org_EEGinfo.Device;
0035 EEGinfo.ChannelName   = org_EEGinfo.ChannelName;
0036 EEGinfo.ChannelID     = org_EEGinfo.ChannelID;
0037 EEGinfo.ActiveChannel = org_EEGinfo.ActiveChannel;
0038 
0039 if isfield(org_EEGinfo, 'ChannelInfo')
0040   EEGinfo.ChannelInfo = org_EEGinfo.ChannelInfo;
0041 end
0042 
0043 save(dst_file, 'Measurement', 'EEGinfo');
0044 return;
0045 %
0046 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0047 
0048 % --- INNER FUNCTIONS -------------------------------------------------------- %
0049 %
0050 % --- inner_check_arguments()
0051 %
0052 function [src_file, dst_file] = inner_check_arguments(src_file, dst_file)
0053 func_ = mfilename;
0054 
0055 if isempty(src_file)
0056   error('(%s) src_file is a required parameter', func_);
0057 end
0058 if isempty(dst_file)
0059   [src_path, src_name] = vb_get_file_parts(src_file);
0060   offset_dot = strfind(src_name, '.');
0061   dst_name = src_name(1:(offset_dot-1));
0062   dst_file = [src_path '/' dst_name '.pos.eeg.mat'];
0063 end
0064 
0065 if exist(src_file, 'file') ~= 2
0066   error('(%s) cannot find src_file %s', func_, src_file);
0067 end
0068 return;
0069 %
0070 % --- end of inner_check_arguments()
0071 %
0072 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0073 
0074 % --- END OF FILE --- %

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005