return number of layer from <<struct>> Headinfo [usage] layer_num = vb_head_get_layer_num(head_info) [input] head_info : <required> <<struct>> Headinfo [output] layer_num : number of layer [note] criterion is the 'Npatch' field. [history] 2007-04-18 (Sako) initial version Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function layer_num = vb_headinfo_get_layer_num(head_info) 0002 % return number of layer from <<struct>> Headinfo 0003 % [usage] 0004 % layer_num = vb_head_get_layer_num(head_info) 0005 % [input] 0006 % head_info : <required> <<struct>> Headinfo 0007 % [output] 0008 % layer_num : number of layer 0009 % [note] 0010 % criterion is the 'Npatch' field. 0011 % [history] 0012 % 2007-04-18 (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_info', 'var') head_file = []; end; 0019 [head_info] = inner_check_arguments(head_info); 0020 0021 % --- MAIN PROCEDURE --------------------------------------------------------- % 0022 % 0023 if isfield(head_info, 'Npatch') && size(head_info.Npatch, 1) > 1 0024 layer_num = size(head_info.Npatch, 1); 0025 else 0026 layer_num = 1; 0027 end 0028 % 0029 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0030 0031 % --- INNER FUNCTIONS -------------------------------------------------------- % 0032 % 0033 function [head_info] = inner_check_arguments(head_info) 0034 if isempty(head_info) 0035 error('head_info is a required parameter'); 0036 end 0037 % 0038 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0039 0040 %%% END OF FILE %%%