|
From: Benjamin v. A. <ben...@gm...> - 2011-08-26 12:16:03
|
If you can live with a dos windows popping up and not using puts oder write
to execute the script but "-e script..." instead, try:
os.execute("start gnuplot -p -e \"plot sin(x)\" > NULL 2>&1")
It will open a separate window with the plot, and even if you close your
app, the window will still be opend. If you want to pipe data into the
process, you need to find another way (windows processes and stuff...)
Maybe that will fix your problem.
PS: Under linux, use gnuplot& instead of start gnuplot .
On Fri, Aug 26, 2011 at 12:36 PM, Mathias Anselmann <
mat...@li...> wrote:
> Hello Ben,
> your hint was really valuable, I'm again a step further now, so I guess
> this is the c syntax that I need:
>
> FILE *pipe = _popen("gnuplot --persist > NULL 2>&1","w");
>
> with this option the output of gnuplot is not displayed on my standard
> output. Unfortunately "--persist" seems to be usesless (also tried "-p") on
> windows, as the plot window closes after the program closes - and that's
> what I don't want. A really weird problem, I didn't think that this story
> can be that tough, in fact I have chosen gnuplot for easy cross-platform
> plotting...
>
> So has anybody got a clue for me here?
> Cheers,
> Mathias
>
> On Fri, 26 Aug 2011 11:19:08 +0200
> Benjamin von Ardenne <ben...@gm...> wrote:
>
> > Hey Mathias,
> >
> > here is some code I use in lua to open gnuplot as a pipe:
> >
> >
> > local gnu = io.popen(string.format("gnuplot -e \"load 'histogram.plt'\"
> > 2>&1") ,"r")
> > local res = gnu:read("*a")
> > gnu:close()
> >
> > Altough it is a little bit differt to yours, try adding the "2>&1" to
> your
> > command. It should reroute the standard output to the stderr stream. As
> you
> > can see, you can still get the gnuplot output by reading from the stream.
> >
> > I hope that will help you.
> >
> > Cheers,
> > Ben
>
|