Hacker News new | ask | show | jobs
by asgeirn 4667 days ago
Would you be able to use Octave for reading from stdin?
1 comments

Yes, Sprint suggested this:

    octave -q --eval "mean = mean(load('$1'))"
But, again, octave requires more time to warm up...
That does not read the data from stdin. You could probably get it to work with some bash wizardry. But maybe not. I did spend some time on this a few years ago and it may have changed in the interim, but my memory is that I tried load("/dev/stdin") and using a fifo etc and it doesn't work (probably because load() uses some seeks to determine matrix data shape before reading data in i.e. data is read in as columns instead of reading in rows and transposing). At least that was my takeaway. At least if you want to use the load() builtin.

Basically you just need to write an octave function that reads values from the terminal.