function mnRealTimeEventHandler(dataUpdate)
%MNREALTIMEEVENTHANDLER Example Money.Net real-time data event handler
%   MNREALTIMEEVENTHANDLER creates a table variable representing a symbol in
%   the MATLAB base workspace, containing the current values of all of its
%   fields. The fields of this table will update as new data becomes
%   available.
%
%   For example,
%
%   realtime(c,'GOOG',@mnRealTimeEventHandler)

%    Copyright 2016 The MathWorks, Inc.

persistent realtimeUpdateStruct

if isempty(realtimeUpdateStruct)
    realtimeUpdateStruct = struct;
end

updateSymbolFieldName = matlab.lang.makeValidName(dataUpdate.Symbol{:});

if isfield(realtimeUpdateStruct,updateSymbolFieldName)
    varNames = dataUpdate.Properties.VariableNames;
    for n = 1:length(varNames)
        realtimeUpdateStruct.(updateSymbolFieldName).(varNames{n}) = dataUpdate.(varNames{n});
    end        
else
    realtimeUpdateStruct.(updateSymbolFieldName) = dataUpdate;
end

assignin('base',[updateSymbolFieldName 'RealTime'],realtimeUpdateStruct.(updateSymbolFieldName));

end

