Making the x axis of a graph move as time goes on and new values enter.
6 次查看(过去 30 天)
显示 更早的评论
We have a flow rate sensor that we were able to connect to an arduino and then get live updates of the flowrate through matlab. However, the experiments we run last several hours and the graph updates to show the new info and keeps the old which then makes it all very small and you can't see the changes that occur. We would like to have about a 3 minute window frame of the graph at all times that moves with the updating data. Then at the end once the experiment is finished we would like to see the whole graph. Thank you for any help.
Here is a picture of the code so far.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1701991/image.png)
0 个评论
采纳的回答
Kunal Kandhari
2024-5-23
Hi Andrew,
You can use the following function within while loop to change the limits with time by putting some if constraints before it
set(gca, 'XLim', [lowerLimit, upperLimit]);
You can read more abot the 'XLim' function from here:
Similarly, you can set/change the y limits as well using 'YLim', read about that here:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!