I have written a piece of code to plot a graph using GNUplot from a data file.
It's giving a warning:
warning: Skipping data file with no valid points
The code is:
{
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...");
}
}
The data file is:
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
Can someone please help me with this?