|
From: Al C. <fa...@gm...> - 2011-04-18 19:25:16
|
Hi,
While working on processing some data from
a voltage acquisition system I have been using
gnuplot to display the test voltages graphically to
the user.
(gnuplot 4.4 patch 0, Linux opensuse 11.4 2.6.37.1-1.2-desktop)
The data acquisition card has its own processor and
transfers binary records to a PCside control process.
The control process then writes the records to a binary
file. Because of the speeds that voltages are coming from
the a/d's it would be nice to plot the data from the
binary file directly, rather than prior conversion to an
ascii file.
The records are written to the binary file with the
statements:
#define BUF_SIZE 1024 //16bit integers
short int databuffer[BUF_SIZE];
...
fwrite (databuffer, sizeof(short)*BUF_SIZE, 1, binLogfile);
Typically these "records" are written about once per second,
and are of fixed length. At the begining of each buffer there
are some counters and identifiers that must be skipped.
I can then plot the contents of the binary file with gnuplot using
e.g.:
plot "rawfile1" binary skip=14 format="%int16%int16%int16" u 1 w l, \
"" binary skip=14 format="%int16%int16%int16" u 2 w l
As you probably expect the first set of counters and identifiers are
skipped as desired, but the rest of the file, with the imbedded identifiers,
are just plotted as data.
What would be nice (? well for me anyway) in gnuplot is to be able
to define a record with perhaps:
plot "file" binary record=2048 format="%*7int16%339(%int16%int16%int16)" u 1
(when I tried this with the "(" and ")" i get the error message:
"Unrecognized binary format specification" with error pointing at the "u" )
Note that it is possible not to use all of the buffer depending on how
many data channels there are(in this case 3). There may be some "undefined"
locations at the end of each buffer, so one might need something like:
plot "file" binary record=2048
format="%*7int16%254(%int16%int16%int16%int16)%*int16" u 1
I have tried other combinations of the binary record, skip, format tags
but without success- though perhaps someone knows of a way to do this?
Thanks,
Al
Gnuplot is a wonderful program by the way.
I've been using it for years and keep discovering new
great features. Many thanks.
|