return number of items that stack has. [USAGE] [N] = vb_stack_get_length(<obj>); [IN] obj : stack object [OUT] N : item number that stack has. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [N] = vb_stack_get_length(obj) 0002 % return number of items that stack has. 0003 % [USAGE] 0004 % [N] = vb_stack_get_length(<obj>); 0005 % [IN] 0006 % obj : stack object 0007 % [OUT] 0008 % N : item number that stack has. 0009 % 0010 % Copyright (C) 2011, ATR All Rights Reserved. 0011 % License : New BSD License(see VBMEG_LICENSE.txt) 0012 0013 % 0014 % --- Previous check 0015 % 0016 if ~exist('obj', 'var'), error('obj is a required parameter.'); end 0017 0018 % 0019 % --- Main Procedure 0020 % 0021 switch(obj.class_type) 0022 case {'m_stack', 'f_stack'} 0023 N = length(obj.queue); 0024 otherwise 0025 error('invalid object is inputted.'); 0026 end 0027 0028 % 0029 % --- After check 0030 %