help-octave
[Top][All Lists]
Advanced

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

octave & (v)tcl: read-write through a pipe...


From: Stef Pillaert
Subject: octave & (v)tcl: read-write through a pipe...
Date: Tue, 17 Oct 2000 19:15:53 +0200

Hello,
I'm (still...) working on a GUI in Tcl/Tk (actually, I use vtcl, which makes it
a bit easier to me to write tcl-scripts) for some octave calculations.

I have a little problem, that I don't know to solve (and I'm not sure whether
it is an octave or a Tcl problem...):

I have a Tcl-button to start octave, with the following command:

{set fileID [open "|/usr/local/bin/octave -qfi" r+]
fconfigure $fileID -buffering line
puts $fileID {PS1 = "";fflush(stdout);} 
flush $fileID
puts $fileID {a=1;fflush(stdout);}
flush $fileID}

And a second button, that activates some octave-command:

{puts $fileID "a=10*a;disp(a);fflush(stdout);ŠÜn"
flush $fileID
gets $fileID result}

As you might have guessed, I show the result variable in a label in my Tcl
window.

2 questions:
** In the third line of the first button, I try to remove the
"octave:1>"-prompt. Unfortunately, the first time I hit the second button, I
get "octave:1>10" in the result-label. The next hits on the second button,
result (as intended) in "100","1000", ... (so without the prompt). What am I
doing wrong that the first time I still have the "octave:1>"-prompt?
(Maybe I'm dreaming, but isn't there a command-line option to invoke octave
without the prompt? I can't find it, but I thought I saw it once...?)

**Suppose I manage to get popen2 to work in octave, what would be the best
approach? Starting octave, and let octave start and communicate with my GUI, or
Starting my GUI, and let it start octave and communicate with it (as in the
above example) 
(Or isn't there a real difference between those approaches?...)

Thanks for any advice,

Stef.







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

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



reply via email to

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