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

vb_f_stack_push

PURPOSE ^

push data into file stack

SYNOPSIS ^

function [obj] = vb_f_stack_push(obj, data)

DESCRIPTION ^

 push data into file stack
 [USAGE]
    [obj] = vb_f_stack_push(<obj>, <data>);
 [IN]
     obj : f_stack object.
    data : push data into f_stack.
 [OUT]
    obj : f_stack object

 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] = vb_f_stack_push(obj, data)
0002 % push data into file stack
0003 % [USAGE]
0004 %    [obj] = vb_f_stack_push(<obj>, <data>);
0005 % [IN]
0006 %     obj : f_stack object.
0007 %    data : push data into f_stack.
0008 % [OUT]
0009 %    obj : f_stack object
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 if ~exist('data', 'var')
0019     error('data is a required parameter.');
0020 end
0021 
0022 %
0023 % --- Main Procedure
0024 %
0025 if ~isinf(obj.stack_size) && (length(obj.queue) >= obj.stack_size)
0026     % delete top
0027     delete(obj.queue{1}); % file delete
0028     obj.queue(1) = [];
0029 end
0030 
0031 % push back
0032 temp_file = [tempname, '.mat'];
0033 vb_fsave(temp_file, 'data');
0034 obj.queue{length(obj.queue)+1} = temp_file;
0035 
0036 %
0037 % --- After check
0038 %
0039 if nargout ~= 1
0040     error('function caller should receive obj.');
0041 end
0042

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