Documentation of pop_stack


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

[ stack, var ] = pop_stack ( stack ) ;

Help text

 function [ stack, var ] = pop_stack ( stack ) ;

 Two valid ways to call this routine
   [ STACK, VAR ] = POP_STACK ( STACK )
          [ VAR ] = POP_STACK
 in the second case, the global stack "GENERAL_STACK" is used 

Listing of function pop_stack

function [ stack, var ] = pop_stack ( stack ) ;

if ~((nargin==1)&(nargout<=2)) & ~((nargin==0)&(nargout<=1));
  help pop_stack
  nargin, nargout
  error('Wrong number of i/o arguments');
end

global GENERAL_STACK

if nargin == 0; stack = GENERAL_STACK; end

[ nt, ns ] = size ( stack );

if nt > 0
  var = stack ( 1, : ); stack = stack ( 2:nt, : );
else
  disp ( ' *** warning : pop empty stack ' );
end;

if nargin == 0; GENERAL_STACK = stack; stack = var; end;