|
From: Philipp K. J. <ja...@ie...> - 2010-01-28 04:02:57
|
On Wednesday 27 January 2010 12:01:33 am ZoltánVörös wrote: > > Maybe somebody can help me out. > > > > I have a C++ program which I want to pipe data to gnuplot such that it > > can display a graph of what is happening as a simulation runs. The > > pipeline itself works fine. What the trouble seems to be is that the > > program writes the data I want displayed to a file which it then commands > > gnuplot to plot. This mostly works, only gnuplot sporadically tells me > > that it cannot plot the datafile because there are no valid points. If I > > step through the program one graph at a time it works fine. > > > > My only suspicion is that gnuplot could be looking for the datafile > > before it has been written to the hard drive and is available again, even > > though C++ is definitely closing and flushing the stream that writes the > > data. Is this likely to be the problem or have I overlooked something? Is > > there any way to solve this? C++ may have written and flushed, but that does not guarantee that the OS has done likewise! I think most solutions to this problem will involve some sort of wrapper script, which will check whether the file is really there and then do some renaming magic. (You might even roll the same functionality into your C++ program.) Alternatively, you can go w/ Zoltan's proposal, which cuts out the disk altogether (in other words, start gnuplot as a subprocess of your C++ program and pipe to it). Assuming you work on Linux/Unix. > > > > Thanks, > > Beleaguered PhD student > > Hello Chris, > > It might be too late for you (I haven't read the forum recently), but I was > wondering whether you could try to pipe the data, too. I did this on the > command line > > echo -e "plot '-' w l\n1 1\n2 3\n e" | gnuplot -persist > > The point is that the data is not written to the disc, so if you can pipe > the data, and tell gnuplot to take it from the prompt, then you shouldn't > have the problem that you described. > I hope this helps, > Zoltán > > > > > --------------------------------------------------------------------------- >--- The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the > business Choose flexible plans and management services without long-term > contracts Personal 24x7 support from experience hosting pros just a phone > call away. http://p.sf.net/sfu/theplanet-com > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info |