function mnNewsStreamEventHandler(newsUpdate)
%MNNEWSSTREAMEVENTHANDLER Example Money.Net news stream event handler
%   MNNEWSSTREAMEVENTHANDLER displays the 10 most recently obtained news
%   stories in a table variable named mnNewsStreamLatest in the MATLAB base
%   workspace, and update the list as news stories become available. 
%
%   For example,
%
%   news(c,'Subscription','on','EventHandler',@mnNewsStreamEventHandler)

%    Copyright 2016 The MathWorks, Inc.

persistent tenLatest

if isempty(tenLatest)
    tenLatest = table;
end

if height(tenLatest) < 10
    tenLatest(end+1,:) = newsUpdate;
else
    tenLatestTemp = tenLatest(2:10,:);
    tenLatestTemp(10,:)=newsUpdate;
    tenLatest = tenLatestTemp;
end

assignin('base','mnNewsStreamLatest',tenLatest);

end

