Next: Hoot, Previous: Gnuplot, Up: Language Quirks [Contents]
Ngspice is very reluctant to print calculated data to standard output,
which makes it challenging for Guile Blocks to extract the result. One
option is to use Ngspice’s print
command, but this is designed for
human readability, adding both headers and an index column. This hurts
Ngspice’s abiility to run in a pipeline with an external graphing
program, such as Gnuplot.
There are two options to resolve this. One is to use the
ngspice-file
language procedure and direct Ngspice to write the data
to a csv file.
(make-block* #:language (ngspice-file <filename>) #:code " .control * ... wrdata <filename> <data> .endc .end")
This will both write the calculated data and set the result
field to
<filename>
.
Another solution is to make use of the ‘/dev/stdout’ special file.
(make-block* #:language ngspice-stdout #:code ".control * ... wrdata /dev/stdout <data> .endc .end")
Using this method, <data>
will be written to standard output and set
as the result
field.