Home > TNNT_1_07 > Stack > pop.m

pop

PURPOSE ^

POP removes values from the head of the stack and returns both

SYNOPSIS ^

function [Stack, Val]=pop(Stack)

DESCRIPTION ^

POP removes values from the head of the stack and returns both

Description:
Function to remove values from the head of the stack and returns both.

Syntax:
[Stack, Val]=POP(Stack);

Input Parameters:
o Stack: A one-dimensional column vector used to store neuron indices.

Output Parameters:
o Stack: A one-dimensionalcolumn vector  used to store neuron indices.
o Val: A scalar neuron index obtained from the head of the stack.

Example:
>> Stack=[1];
>> [Stack, Val]=pop(Stack)

See also theta_neuron_network

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Stack, Val]=pop(Stack)
0002 %POP removes values from the head of the stack and returns both
0003 %
0004 %Description:
0005 %Function to remove values from the head of the stack and returns both.
0006 %
0007 %Syntax:
0008 %[Stack, Val]=POP(Stack);
0009 %
0010 %Input Parameters:
0011 %o Stack: A one-dimensional column vector used to store neuron indices.
0012 %
0013 %Output Parameters:
0014 %o Stack: A one-dimensionalcolumn vector  used to store neuron indices.
0015 %o Val: A scalar neuron index obtained from the head of the stack.
0016 %
0017 %Example:
0018 %>> Stack=[1];
0019 %>> [Stack, Val]=pop(Stack)
0020 %
0021 %See also theta_neuron_network
0022 
0023 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0024 
0025 
0026 if ~isempty(Stack)
0027     Val=Stack(1);
0028     Stack=Stack(2:end);
0029 else
0030     Val=[];
0031     Stack=[];
0032 end

Generated on Wed 02-Apr-2008 15:16:32 by m2html © 2003