next up previous contents index
Next: Example datafile Up: Data-file Previous: Data-file   Contents   Index


Binary matrix

Gnuplot can read matrix binary files by use of the option binary appearing without keyword qualifications unique to general binary, i.e., array, record, format, or filetype. Other general binary keywords for translation should also apply to matrix binary. (See binary general (p. [*]) for more details.)

In previous versions, gnuplot dynamically detected binary data files. It is now necessary to specify the keyword binary directly after the filename.

Single precision floats are stored in a binary file as follows:


     <N+1>  <y0>   <y1>   <y2>  ...  <yN>
      <x0> <z0,0> <z0,1> <z0,2> ... <z0,N>
      <x1> <z1,0> <z1,1> <z1,2> ... <z1,N>
       :      :      :      :   ...    :

which are converted into triplets:

     <x0> <y0> <z0,0>
     <x0> <y1> <z0,1>
     <x0> <y2> <z0,2>
      :    :     :
     <x0> <yN> <z0,N>


     <x1> <y0> <z1,0>
     <x1> <y1> <z1,1>
      :    :     :

These triplets are then converted into gnuplot iso-curves and then gnuplot proceeds in the usual manner to do the rest of the plotting.

A collection of matrix and vector manipulation routines (in C) is provided in binary.c. The routine to write binary data is


     int fwrite_matrix(file,m,nrl,nrl,ncl,nch,row_title,column_title)

An example of using these routines is provided in the file bf_test.c, which generates binary files for the demo file demo/binary.dem.

The index keyword is not supported, since the file format allows only one surface per file. The every and using filters are supported. using operates as if the data were read in the above triplet form.

See also binary general (p. [*]) and

http://www.gnuplot.info/demo/binary.htmlBinary File Splot Demo.


next up previous contents index
Next: Example datafile Up: Data-file Previous: Data-file   Contents   Index
Ethan Merritt 2007-03-03