Home > functions > common > utility > stack > tools > vb_f_stack_pop.m

vb_f_stack_pop

PURPOSE ^

pop data from file stack

SYNOPSIS ^

function [obj, data] = vb_f_stack_pop(obj)

DESCRIPTION ^

 pop data from file stack
 [USAGE]
    [obj, data] = vb_f_stack_pop(<obj>);
 [IN]
    obj : f_stack object.
 [OUT]
     obj : f_stack object.
    data : pop data from f_stack.

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [obj, data] = vb_f_stack_pop(obj)
0002 % pop data from file stack
0003 % [USAGE]
0004 %    [obj, data] = vb_f_stack_pop(<obj>);
0005 % [IN]
0006 %    obj : f_stack object.
0007 % [OUT]
0008 %     obj : f_stack object.
0009 %    data : pop data from f_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 data = [];
0023 last_ix = length(obj.queue);
0024 if last_ix ~= 0
0025     temp_file = obj.queue{last_ix};
0026     load(temp_file, 'data');
0027     % delete pop data
0028     if ~isempty(obj.queue{last_ix}) && exist(obj.queue{last_ix}, 'file') == 2
0029         delete(obj.queue{last_ix}); % delete file
0030         obj.queue(last_ix) = [];
0031     end
0032 end
0033 
0034 %
0035 % --- After check
0036 %
0037 if nargout < 1
0038     error('function caller should receive obj.');
0039 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005