How to generate graph at the same time that data is obtained?
1 回表示 (過去 30 日間)
古いコメントを表示
How to generate graph at the same time that data is obtained?
0 件のコメント
回答 (1 件)
Matthew
2017 年 12 月 20 日
One thing you can do is add new data to an already existing plot.
figure;
plot(1:10,1:10);
ah = gca;
for loopIX = 11:100
%New Data becomes available
newXValue = loopIX;
newYValue = rand;
%Add the new data to the plot
ah.Children.XData(end+1) = newXValue;
ah.Children.YData(end+1) = newYValue;
end
Note that you may get warnings about the data arrays being sized wrong between the Xdata update and the Ydata update.
5 件のコメント
Walter Roberson
2017 年 12 月 21 日
alcides silva:
At each time that you have a new point available, call addpoints() on the animatedLine() object, and then call drawnow().
Depending on your needs, you might want to set the 'MaximumNumPoints' option when you create the animatedLine
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!