SLIDE_WINDOW
Applies to PredictiveInsight only.
Syntax
SLIDE_WINDOW(width, data [, increment])
Parameters
width
The size (vertical number of rows) of the sliding window.
data
The cell range to use to slide a window over to generate data. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your IBM® product.
increment
The number of rows to increment each time; the default is one. This must be an integer greater than zero (and less than the length of data).
Description
SLIDE_WINDOW uses a specified window size and slides it over the specified data range, creating patterns from the window data values. It returns (the number of input columns x width) columns. The sliding window begins at the top of data and covers width rows. The data values in this window (read left to right, top to bottom) are concatenated together to form a single row in the output data range. The sliding window moves down by increment rows each time.
For example, assume the columns V1 and V2 contain the following data:
10 2 20 3 30 4 40 5 50 ...
Then the expression V3=SLIDE_WINDOW(2, V1:V2) produces the following output in columns V3:V6:
10 2 20 2 20 3 30 3 30 4 40 ...
The first two rows create the first row of output. Then the window slides down one row to create the next pattern, and so on.
*
Examples
Creates a new column named TEMP containing a copy of the values in column V1.
Creates nine new columns with each row containing a three-by-three window of data from columns V1:V3. Rows 1-3 of the input form the first row of output, rows 2-4 form the second, etc.
Creates six new columns with each row containing a three-by-two window of data from rows 10-20 of columns V1:V3. Rows 10-11 of the input form the first row of output, rows 11-12 form the second, etc.
Creates six new columns with each row containing a three-by-two window of data from columns V1, V3, and V5. Rows 1-2 of the input form the first row of the output, rows 2-3 form the second, etc.
Creates three new columns, where the first row contains data from V1[1]:V3, the second row contains data from V1[3]:V3, the third row contains data from V1[5]:V3, and so on (every other row is skipped).
Creates ten new columns, where the first row contains data from V1[1:10], the second row contains data from V1[11:20], the third row contains data from V1[21:30], and so on.
Creates six new columns, where each row contains a two-by-three window of data from columns V1:V2. The first row contains data from V1[1:3]:V2; the second row contains data from V1[6:8]:V2, the third row contains data from V1[11:13]:V2, and so on.
Related Functions