How to skip certain bytes at the begining of a binary file in Gnuplot?
Say I have a binary file which has the following format: 4*sizeof(double), 4*sizeof(size_t), (Ny*Nx)*dizeof(double).
The first 4 doubles and the 4 size_ts are metainformation about the file. The rest is data I want to plot with gnuplot.
Right now I have to convert the file to another one without the header to plot using the command:
plot "convertedfile.data" binary format='%double' array=(Ny, Nx) u 1 w image
Q: Is there any way to tell gnuplot to ignore th开发者_开发知识库e starting N
bytes of the binary file and then plot the rest as if its a matrix?
You can skip some bytes at the beginning with skip
plot "convertedfile.data" binary skip=16 format='%double' array=(Ny, Nx) u 1 w image
will skip the first 16 bytes of the file.
The simplest solution is probably to write a small C program to strip off the metainfomation and write the remaining data to a new file.
精彩评论