gnuplot:只使用最后n行

编程入门 行业动态 更新时间:2024-10-23 21:32:25
本文介绍了gnuplot:只使用最后n行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用python脚本将两个温度传感器的数据记录到.csv文件。对于每次读取(每5分钟),一个新行被添加到文件的结尾。

谢谢!

$ b如何使gnuplot只使用最后288行? $ b

: :

感谢@Istvan Chung的提示。 b $ b

一个简单的

tail -n 288 datafile.csv'using ...

似乎做到了。

解决方案

一个简单的解决方案是使用unix tail 命令选择最后288行。

我在评论中建议

tail -n 288< file& | gnuplot -p -eset datafile separator \,\; plot' - '

应该工作。根据对原始问题的编辑,这里正确的语法是

的形式

plot'< tail -n 288 datafile.csv'using ...

I'm using a python script to record data from two temperature sensors to a .csv file. For every reading (every 5 mins) a new line is added to the end of the file. How can I get gnuplot to only use the last 288 lines, so I will end up with a graph for the last 24 hrs?

Thanks!

:Edit:

Got it, thanks for the hint @Istvan Chung.

A simple

plot '< tail -n 288 datafile.csv' using ...

seems to do the trick.

解决方案

An easy solution here is to use the unix tail command to select the last 288 lines.

I suggested in a comment that

tail -n 288 <file> | gnuplot -p -e "set datafile separator \",\"; plot '-'"

should work. According to an edit on the original question, the correct syntax here was of the form

plot '< tail -n 288 datafile.csv' using ...

更多推荐

gnuplot:只使用最后n行

本文发布于:2023-10-18 12:55:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504287.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:gnuplot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!