return number of layer by reading head-mat file [usage] layer_num = vb_head_get_layer_num(head_file) [input] head_file : <required> head-mat file [output] layer_num : number of layer [note] [history] 2007-04-17 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function layer_num = vb_head_get_layer_num(head_file) 0002 % return number of layer by reading head-mat file 0003 % [usage] 0004 % layer_num = vb_head_get_layer_num(head_file) 0005 % [input] 0006 % head_file : <required> head-mat file 0007 % [output] 0008 % layer_num : number of layer 0009 % [note] 0010 % 0011 % [history] 0012 % 2007-04-17 (Sako) initial version 0013 % 0014 % Copyright (C) 2011, ATR All Rights Reserved. 0015 % License : New BSD License(see VBMEG_LICENSE.txt) 0016 0017 % --- CHECK ARGUMENTS --- % 0018 if ~exist('head_file', 'var') head_file = []; end; 0019 [head_file] = inner_check_arguments(head_file); 0020 0021 % --- MAIN PROCEDURE --------------------------------------------------------- % 0022 % 0023 head = load(head_file); 0024 layer_num = vb_headinfo_get_layer_num(head); 0025 % if isfield(head, 'Npatch') && size(head.Npatch, 1) > 1 0026 % layer_num = size(head.Npatch, 1); 0027 % else 0028 % layer_num = 1; 0029 % end 0030 % 0031 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0032 0033 % --- INNER FUNCTIONS -------------------------------------------------------- % 0034 % 0035 function [head_file] = inner_check_arguments(head_file) 0036 if isempty(head_file) 0037 error('head_file is a required parameter'); 0038 end 0039 0040 if exist(head_file, 'file') ~= 2 0041 error('cannot read head_file : %s', head_file); 0042 end 0043 % 0044 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0045 0046 %%% END OF FILE %%%