2016-07-14 5 views
1

データファイルからGNUplotを使用してグラフをプロットするコードを書いています。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 
有効なポイント

コードがあると、データファイルをスキップ

誰かがこれで私を助けてくれますか?

+0

ファイルにあなたのパイプ出力を送信し、それが有効なgnuplotのスクリプトであるかどうか確認をお勧めすることができます。 Btw: "GNUplot"ではなく "gnuplot"です。 – Karl

答えて

1

あなたが同時にファイルやストリームをプロットすることはできませんGnuplot

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

するための手段とその

plot \"%s\" '-' 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); 
+0

それはうまくいった。ありがとう、たくさんの男。 –

関連する問題