help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Blocking I/O to gnuplot pipe


From: David Bateman
Subject: Blocking I/O to gnuplot pipe
Date: Fri, 14 Feb 2003 11:50:11 -0600
User-agent: Mutt/1.3.28i

First the brief description: Is it possible to performing blocking I/O
    to the gnuplot command pipe?

Now the long description. I have a discontinous data set, which the
gnuplot command nicely handles by treating a blank link in the data as
the start of a new line segment. However I've found no way of getting
such behaviour directly with gplot in octave. Plotting the data as
multiple lines is horribly slow if you have thousands of segments!!!!

So what I did was create a temporary file with tmpnam, write my data to
it with the required line breaks, and then call gplot on this temporary
file. Fine up to this point. However, the problem comes about when I
want to get rid of the temporary file. As the octave sends data to the
gnuplot process with O_NONBLOCK flag set, control returns to the prompt
before the gnuplot command is finished as my actual gnuplot command is
something like

subplot(2,1,1)
gplot 'tmpfile'
subplot(2,1,2)
gplot 'tmpfile' using 1:3

then octave passes these commands into the gnuplot pipe, before gnuplot has
finished with the first plot. My call to "unlink(tmpfile)" then deletes the
file and the second plot doesn't appear.

Splitting this up into two seperate temporary files doesn't help as
the basic problem is that I get to the unlink command before gnuplot
has finished.

So, what I wanted to know. Is there a file descriptor for the gnuplot
pipe in a script file?  Can I use "fcntl" on it to clear the
O_NONBLOCK flag?

Regards
David


-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 25 00 (Ph)
Espace Technologique, Commune de St Aubin    +33 1 69 35 25 01 (Fax)
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]