The attached patch adds two options to the set table command.
The first option 'clip' removes the last text column with the point type and only writes the points into the table that fall inside the active range.
The second option 'symerr' replaces the error bands ("y ylow yhigh") with a single value ("y yerr") specifying the errorbar, e.g. "10 9.5 10.5" becomes "10 0.5".
Both options are useful when the set table command is used together with a more advanced plot command (e.g. smooth freq) and the resulting table is used afterwards to fit a function to this data.
With the new plot style "table", you can already define arbitrary columns to be written to the file, without the "i"/"o" mark.
What is missing is an option to selectively suppress points that are invalid (NaN) and/or outside the current yrange.
Last edit: Karl Ratzsch 2014-06-24
This could be done by adding an option "suppress" to "with table". It would then evaluate an additional "using" entry. E.g.
If the third column evaluates to NaN (or zero?), the line would not be printed at all, one prints it.
Additionally, minus one could cause an empty line to be printed instead, minus 2 for two empy lines.
Patch attached that is under consideration for 5.3 and 5.2
It fixes a couple of real problems so I will probably apply it soon.
However it also adds a new option to filter the data points written into a table that seems like it would address your request. It is marked EXPERIMENTAL in the documentation and may change a bit before the feature is added.
Documentation section here:
Last edit: Ethan Merritt 2017-07-19
All of this is now in 5.3
The "with table" code in 5.2 has been updated to fix bugs and to handle strings but I did not add the input filter code. Let's give that a trial in 5.3 so that people can point out all the better ways to do it that I didn't think of :-)
For completeness, here is a patch adding the current state of "with table if <expression>" to 5.2