For background information and context for my question, please read this question.
Notice in the updatePlot()
method of my DynamicPlotter
code, I kind of "reach into" a DynamicDataset
property, as follows:
function updatePlot(obj, propNum)
X = get(obj.LH(propNum), 'XData');
Y = get(obj.LH(propNum), 'YData');
X(end+1) = obj.(dynProps{propNum}).newestData(1);
Y(end+1) = obj.(dynProps{propNum}).newestData(2);
set(obj.LH(propNum), 'XData', X, 'YData', Y);
end
updatePlot
is a listener callback. Rather than "reach in" to go get the newestData
, I am wondering if it would be more efficient to have the data "presented" to the callback with event.eventData
. But I am unsure of (a) how to even use event.eventData
(the example provided in the documentation isn't very clear to me), and (b) if this yields better or worse performance.
So I guess my main question is, what's the best way for updatePlot()
to access the newestData
as depicted in the method above: "reaching in and retrieving it" or using event.eventData
to "send" the data point to the function to plot?
I hope this wasn't terribly ambiguous.