Home > functions > device > meg > vb_megfile_set_spherical_data.m

vb_megfile_set_spherical_data

PURPOSE ^

set spherical data (Vcenter, Vradius) to a .meg.mat file

SYNOPSIS ^

function vb_megfile_set_spherical_data( meg_file, sph_data )

DESCRIPTION ^

 set spherical data (Vcenter, Vradius) to a .meg.mat file
 [usage]
   vb_megfile_set_spherical_data( meg_file, sph_data )
 [input]
   meg_file : <required> <<file>> updated file
   sph_data : <required> <<struct>> data of spherical model
               following fields are required.
               .Vcenter : (x,y,z) center coordinate of the spherical model
               .Vradius : [m] radius of the spherical model
 [output]
   none
 [note]
   updated fields are MEGinfo.Vcenter and MEGinfo.Vradius
 [history]
   2011-05-25 (Sako) initial version

 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_megfile_set_spherical_data( meg_file, sph_data )
0002 % set spherical data (Vcenter, Vradius) to a .meg.mat file
0003 % [usage]
0004 %   vb_megfile_set_spherical_data( meg_file, sph_data )
0005 % [input]
0006 %   meg_file : <required> <<file>> updated file
0007 %   sph_data : <required> <<struct>> data of spherical model
0008 %               following fields are required.
0009 %               .Vcenter : (x,y,z) center coordinate of the spherical model
0010 %               .Vradius : [m] radius of the spherical model
0011 % [output]
0012 %   none
0013 % [note]
0014 %   updated fields are MEGinfo.Vcenter and MEGinfo.Vradius
0015 % [history]
0016 %   2011-05-25 (Sako) initial version
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 % --- CHECK ARGUMENTS --- %
0022 if ~exist('meg_file', 'var'), meg_file = ''; end
0023 if ~exist('sph_data', 'var'), sph_data = []; end
0024 [meg_file, sph_data] = inner_check_arguments(meg_file, sph_data);
0025 
0026 % --- MAIN PROCEDURE --------------------------------------------------------- %
0027 %
0028 meg = load(meg_file);
0029 if isfield(sph_data, 'Vcenter')
0030   meg.MEGinfo.Vcenter = sph_data.Vcenter;
0031 end
0032   
0033 if isfield(sph_data, 'Vradius')
0034   meg.MEGinfo.Vradius = sph_data.Vradius;
0035 end
0036 
0037 vb_save_struct(meg_file, meg);
0038 return;
0039 %
0040 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0041 
0042 % --- INNER FUNCTIONS -------------------------------------------------------- %
0043 %
0044 % --- inner_check_arguments()
0045 %
0046 function [meg_file, sph_data] = inner_check_arguments(meg_file, sph_data)
0047 func_ = mfilename;
0048 
0049 if isempty(meg_file)
0050   error('(%s) meg_file is a required parameter', func_);
0051 end
0052 if exist(meg_file, 'file') ~= 2
0053   error('(%s) cannot be found meg_file : %s', func_, meg_file);
0054 end
0055 
0056 if isempty(sph_data)
0057   error('(%s) sph_data is a required parameter', func_);
0058 end
0059 return;
0060 %
0061 % --- end of inner_check_arguments()
0062 %
0063 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0064 
0065 % --- END OF FILE --- %
0066 
0067

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