how to plot only one datapoint at a time with a 1 second delay from a dataset
21 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I have a matrix made of 3 columns and a random number of rows (for example TestPoints=[1 4 6;2 1 4;3 2 3;4 1 5;5 3 4;6 1 6;7 2 6;8 2 6];). I want to plot the second and third column (will call these X & Y). I do not care about the first column. The first column could be thought as time in seconds and the second and third coumns are Measurement 1 and Measurement 2 respectively.
However, I want to plot the first X and Y point first, followed by a 1 second delay before it plots the next X and Y point. I want it to keep doing this until it has gone through every row. Note: I do not want the previous point to show on the plot when the new point is plotted.
0 个评论
采纳的回答
the cyclist
2020-10-21
Here is one way:
TestPoints=[1 4 6;2 1 4;3 2 3;4 1 5;5 3 4;6 1 6;7 2 6;8 2 6];
figure
for nr = 1:size(TestPoints,1)
plot(TestPoints(nr,2),TestPoints(nr,3),'.','MarkerSize',40);
set(gca,'XLim',[min(TestPoints(:,2)),max(TestPoints(:,2))],'YLim',[min(TestPoints(:,3)),max(TestPoints(:,3))])
pause(1)
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!