function Persistent_demo()
%---------------------------------------------------------------
%       USAGE: Persistent_demo()
%
%      AUTHOR: Col David S. Gibson       DATE: 11 Feb 05
%    MODIFIED: Dr. Wayne Brown           DATE: 22 Aug 05
%
% DESCRIPTION: Demonstrate the behavior of persistent variables 
%
%      INPUTS: None
%
%     OUTPUTS: None
%
%  REFERENCES: None
%---------------------------------------------------------------

persistent Counter

if isempty(Counter)
    Counter = 1;            % initialize first time
else
    Counter = Counter + 1;  % increment other times
end

fprintf('Counter = %d\n', Counter)

end % function persistent_demo