Script Command Filter
Script Command: 
Filter (Mode, Width, Direction, Storage, Range) 
The script command "filter" allows the application of a filter on the selected data according to the parameters Mode, Width, Range and Storage. The parameters are defined as follows:
Mode 
The parameter Mode controls the filter type which is applied to the data. Mode may assume one of the following 7 values:
fir: applies a FIR filter which is specified by the coefficients ai (the coefficients bi are set to zero values automatically). The coefficients have to specified by the command Filtercoeffs prior to the execution of the command Filter.
iir: applies the IIR filter using the coefficients ai and bi, as they have been specified by the command Filtercoeffs.
mavg: calculates a moving average smoothing
wavg: creates a weighted average smoothing
median: calculates a moving median smoothing
savgol: calculates the 2nd order SavitzkyGolay smoothing
deriv1: calculates the smoothed first derivative
deriv2: computes the smoothed second derivative

Width 
Specifies the width of the filter window. The width parameter may assume values between 1 and 100 for FIR and IIR filters, for all other filters the valid range are odd values between 5 and 25.

Direction 
Specifies whether the filter is applied columnwise or rowise and which columns or rows are to be processed. The parameter may take the values cols and rows and has to be followed by a '=' character by the list of columns or rows in square brackets. The column or row numbers have to be separated by commas, a range of columns/rows can be specified by a colon (see examples below).

Storage 
"Storage" controls how the results are stored, valid values are overwrite, append, and auxmat. In the first case the results are written over the original data, in the second case the results are appended to the data matrix (for this purpose the data matrix is extended by the appropriate number of columns or rows), and in the third case the results are stored in one of the auxiliary matrices of the matrix clipboard. The index of the auxiliary matrix has to be specified by an '=' sign followed by the index number between 1 and 8 (see below for an example). 
Range 
Restricts the range where the filter is applied. If the filtering occurs columnwise (parameter "Direction") the range specifies the first and the last row, with rowwise filtering the range specifies the first and the last column. The range has to be defined by the keyword "range" followed by an equal sign and the first and the last column/row in square brackets. The first and the last column/row is separated by a colon. In order to apply the calculation to the entire set of rows/columns without explicitely specifying the first and last column/row, the range may be declared as range=[0:0].

Examples:
filter (deriv1, 15, rows=[1:225], overwrite, range=[0:0])
The command calculates the smoothed first derivatives of the rows 1 to 225 using a window width of 15. The results are writen over the original data. The range of the calculation is not restricted.
filter (mavg, 7, cols=[2,9:13,17], append, range=[100:800])
The command calculates the moving average of the columns 2, 9 to 13, and 17 using a window width of 7. The calculation is restricted to the range of rows between row 100 and row 800. The results are appended to the data matrix. Thus, the matrix is enlarged by 7 columns which are then used to store the results; the original data are left unchanged.
filter (savgol, 11, cols=[1:10], auxmat=4, range=[0:0])
The command calculates the SavitzkyGolay smoothing of the columns 1 to 10 using a window width of 11. The results are written into auxiliary matrix 4 of the matrix clipboard. Any previous values of matrix 4 are overwritten. The range of the calculation is not restricted.
