GNUPlot: 警告: 跳过没有有效点的数据文件

GNUPlot: Warning: Skipping data file with no valid points

本文关键字:文件 有效 数据 警告 GNUPlot      更新时间:2023-10-16

我写了一段代码,用GNUplot从数据文件中绘制一个图。

它给出了一个警告:

警告:跳过没有有效点的数据文件

代码为:

{
FILE *gnuplotPipe, *tempDataFile;
FILE * pFile;
char *tempDataFileName;
char *Datafile;
double x, y;
int i;
tempDataFileName = "Pulse.txt";
Datafile = "PulseFinal.dat";
gnuplotPipe = _popen("gnuplot", "w");
if (gnuplotPipe)
{
    fprintf(gnuplotPipe, "plot "%s" '-' using 1:2 with lines", Datafile);
    fflush(gnuplotPipe);
    printf("press enter to continue...");
    getchar();
    fprintf(gnuplotPipe, "exit n");
}
else
{
    printf("gnuplot not found...");
}
}

数据文件为:

0.000000 0.018519
1.000000 0.000000
2.000000 0.000000
3.000000 0.000000
4.000000 0.000000
5.000000 0.000000
6.000000 0.000000
7.000000 0.000000
8.000000 0.000000
9.000000 0.000000
10.000000 -0.006173

有人可以帮我吗?

你试过

plot "%s" '-' using 1:2 with lines

这意味着Gnuplot

plot "YPulseFinal.dat" '-' using 1:2 with lines

不能同时打印文件和流。您可以

plot "YPulseFinal.dat" using 1:2 with lines

plot '-' using 1:2 with lines

我推荐你

fprintf(gnuplotPipe, "plot "%s" using 1:2 with lines", Datafile);