<<getter>> return center and radius from POS-MAT file [usage] [center, radius, c_type] = vb_posfile_get_sphericalinfo(posfile) [input] posfile : <required> <<file>> POS-MAT file [output] center : center coordinate of spherical head [1x3 double] radius : radius of spherical head [x1 double] c_type : coordinate type [x1 string] [note] [history] 2008-02-25 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [center, radius, c_type] = vb_posfile_get_sphericalinfo(posfile) 0002 % <<getter>> return center and radius from POS-MAT file 0003 % [usage] 0004 % [center, radius, c_type] = vb_posfile_get_sphericalinfo(posfile) 0005 % [input] 0006 % posfile : <required> <<file>> POS-MAT file 0007 % [output] 0008 % center : center coordinate of spherical head [1x3 double] 0009 % radius : radius of spherical head [x1 double] 0010 % c_type : coordinate type [x1 string] 0011 % [note] 0012 % 0013 % [history] 0014 % 2008-02-25 (Sako) initial version 0015 % 0016 % Copyright (C) 2011, ATR All Rights Reserved. 0017 % License : New BSD License(see VBMEG_LICENSE.txt) 0018 0019 % --- CHECK ARGUMENTS --- % 0020 if ~exist('posfile', 'var'), posfile = []; end 0021 [posfile] = inner_check_arguments(posfile); 0022 0023 % --- MAIN PROCEDURE --------------------------------------------------------- % 0024 % 0025 center = []; 0026 radius = []; 0027 c_type = []; 0028 0029 pos = load(posfile); 0030 if ~isfield(pos, 'spherical_info') 0031 return; 0032 end 0033 center = pos.spherical_info.Vcenter; 0034 radius = pos.spherical_info.Vradius; 0035 c_type = pos.spherical_info.coord_type; 0036 return; 0037 % 0038 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0039 0040 % --- INNER FUNCTIONS -------------------------------------------------------- % 0041 % 0042 % --- inner_check_arguments() 0043 % 0044 function [posfile] = inner_check_arguments(posfile) 0045 func_ = mfilename; 0046 if isempty(posfile) 0047 error('(%s)posfile is a required parameter', func_); 0048 end 0049 if exist(posfile, 'file') ~= 2 0050 error('(%s)cannot find posfile : %s', func_, posfile); 0051 end 0052 return; 0053 % 0054 % --- end of inner_check_arguments() 0055 % 0056 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0057 0058 % --- END OF FILE --- %