Skipping empty files in Gnuplot

对着背影说爱祢 提交于 2019-12-06 16:39:46

I could not find any hack that used only gnuplot commands. As a result, I am posting a work around which takes the help of shell to find if file1.dat has any any lines of data or not.

The condition in the gnuplot script file will look like :

if(system("awk '{x++}END{ print x}' file1.dat")>0){
    plot "file1.dat" using 1:2 w l lt 1 lw 1 lc 3,\
    "file2.dat" using 1:2 w l lt 1 lw 1 lc 3
}else{
    plot "file2.dat" using 1:2 w l lt 1 lw 1 lc 3
}

I still would be grateful if anyone can give me a gnuplot command only method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!