Piping output of a program to a scilab script

classic Classic list List threaded Threaded
3 messages Options
Mathieu Dubois Mathieu Dubois
Reply | Threaded
Open this post in threaded view
|

Piping output of a program to a scilab script

Hello,

I would like to know if it's possible to use scilab in a standard UNIX
pipeline.

I have some programs that output their results to stdout and I would
like to read it from scilab.

I know I can launch scilab in batch mode with "-nb -nwni" and execute a
command with-e.

I have tried to pass "exec(myscript.sci); myscript(); quit;" to scilab
where myscript contains something like this:
while ~meof(%io(1))
         S = mgetl(%io(1));
         // Process line
end
fprintf(0, 'Nothing more to read\n');

Unfortunately, scilab immediately prints "Nothing more to read" and quits.

Am I doing something wrong? Any idea?

Mathieu

P.S.: It's easy to check that meof(%io(1)) always returns 1. I guess
this is because standard input refers to the scilab command line (which
waits for input) and not to the process standard input.

--
To unsubscribe from this mailing-list, please send an empty mail to
[hidden email]
To check the archives of this mailing list, see
http://mailinglists.scilab.org/

Sylvestre Ledru-4 Sylvestre Ledru-4
Reply | Threaded
Open this post in threaded view
|

Re: Piping output of a program to a scilab script

On 04/05/2012 12:39, Mathieu Dubois wrote:

> Hello,
>
> I would like to know if it's possible to use scilab in a standard UNIX
> pipeline.
>
> I have some programs that output their results to stdout and I would
> like to read it from scilab.
>
> I know I can launch scilab in batch mode with "-nb -nwni" and execute
> a command with-e.
With 5.3.3 (and the current nightly), the following cases are working:
$ echo "a=1+%pi; disp(a)"|scilab-cli
 
$ echo "a=1+%pi; disp(a)" > plop.sci && cat plop.sci |scilab-cli

Sylvestre


--
To unsubscribe from this mailing-list, please send an empty mail to
[hidden email]
To check the archives of this mailing list, see
http://mailinglists.scilab.org/

farimani farimani
Reply | Threaded
Open this post in threaded view
|

Re: Piping output of a program to a scilab script

Sorry this is a very old thread, but is piping inside scilab is also
possible? I want to pipe the result of whos command into a tlist but I
can't!



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users