My script generates a number of data blocks with set table, like
set table $Temp1
plot 'file' u 1:2 w table
unset table
They are generated under some conditions, such that if those conditions are not fulfilled, they remain empty.
At the end of the day, I have to plot them all. Problem is that if any of them is empty, I get an error message when plotting it, namely Column number or datablock line expected
rather than just ignoring that datablock which is what I would like.
I've tried Gnuplot, how to *skip* missing data files? but this seems to work only for empty files, not empty datablocks
The cardinality operator |<name>|
will return the size of the data block, i.e. the number of lines.
gnuplot> $DATA << EOD
1
2
EOD
gnuplot> $EMPTY << EOD
EOD
gnuplot> data_size = |$DATA|
gnuplot> empty_size = |$EMPTY|
gnuplot> print data_size
2
gnuplot> print empty_size
0
gnuplot>