pop data from memory stack [USAGE] [obj, pop_data] = vb_m_stack_pop(<obj>); [IN] obj : m_stack object. [OUT] obj : m_stack object. pop_data : pop data from m_stack. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [obj, pop_data] = vb_m_stack_pop(obj) 0002 % pop data from memory stack 0003 % [USAGE] 0004 % [obj, pop_data] = vb_m_stack_pop(<obj>); 0005 % [IN] 0006 % obj : m_stack object. 0007 % [OUT] 0008 % obj : m_stack object. 0009 % pop_data : pop data from m_stack. 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 0014 % 0015 % --- Previous check 0016 % 0017 if ~exist('obj', 'var'), error('obj is a required parameter.'); end 0018 0019 % 0020 % --- Main Procedure 0021 % 0022 pop_data = []; 0023 last_ix = length(obj.queue); 0024 if last_ix ~= 0 0025 pop_data = obj.queue(last_ix); 0026 % delete pop data 0027 obj.queue(last_ix) = []; 0028 end 0029 0030 % 0031 % --- After check 0032 % 0033 if nargout < 1 0034 error('function caller should receive obj.'); 0035 end