# Example 13: Windowing Data with WindowData()

Create a sequence of integers from 1 - 1000 and segment the values into windows of length 75, with no overlap.

```X = 1:1000
[WinData, Log] = WindowData(X, WinLen = 75)

>>> WinData =
{[ 1,  2,  3,  4,  5, ... 71, 72, 73, 74, 75];
[ 76,  77,  78,  79, 80, ...  146, 147, 148, 149, 150];
[ 151, 152, 153, 154, 155, ... 221, 222, 223, 224, 225];
[ 226, 227, 228, 229, 230, ... 296, 297, 298, 299, 300];
[ 301, 302, 303, 304, 305, ... 371, 372, 373, 374, 375];
[ 376, 377, 378, 379, 380, ... 446, 447, 448, 449, 450];
[ 451, 452, 453, 454, 455, ... 521, 522, 523, 524, 525];
[ 526, 527, 528, 529, 530, ... 596, 597, 598, 599, 600];
[ 601, 602, 603, 604, 605, ... 671, 672, 673, 674, 675];
[ 676, 677, 678, 679, 680, ... 746, 747, 748, 749, 750];
[ 751, 752, 753, 754, 755, ... 821, 822, 823, 824, 825];
[ 826, 827, 828, 829, 830, ... 896, 897, 898, 899, 900];
[ 901, 902, 903, 904, 905, ... 971, 972, 973, 974, 975]}

>>> Log =
struct with fields:
DataType: "single univariate vector (1 sequence)"
DataLength: 1000
WindowLength: 75
WindowOverlap: 0
TotalWindows: 13
Mode: "exlcude"
```

Repeat the previous step, but include any remaining values that do not fill the final window.

```WinData, Log = WindowData(X, WinLen = 75, Mode = 'include')

>>> WinData =
{[ 1,  2,  3,  4,  5, ... 71, 72, 73, 74, 75];
[ 76,  77,  78,  79, 80, ...  146, 147, 148, 149, 150];
[ 151, 152, 153, 154, 155, ... 221, 222, 223, 224, 225];
[ 226, 227, 228, 229, 230, ... 296, 297, 298, 299, 300];
[ 301, 302, 303, 304, 305, ... 371, 372, 373, 374, 375];
[ 376, 377, 378, 379, 380, ... 446, 447, 448, 449, 450];
[ 451, 452, 453, 454, 455, ... 521, 522, 523, 524, 525];
[ 526, 527, 528, 529, 530, ... 596, 597, 598, 599, 600];
[ 601, 602, 603, 604, 605, ... 671, 672, 673, 674, 675];
[ 676, 677, 678, 679, 680, ... 746, 747, 748, 749, 750];
[ 751, 752, 753, 754, 755, ... 821, 822, 823, 824, 825];
[ 826, 827, 828, 829, 830, ... 896, 897, 898, 899, 900];
[ 901, 902, 903, 904, 905, ... 971, 972, 973, 974, 975];
[ 976, 977, 978, 979, 980, ... 996, 997, 998, 999, 1000]}   <- Remaining values included in final array (N = 25)

>>> Log =
struct with fields:
DataType: "single univariate vector (1 sequence)"
DataLength: 1000
WindowLength: 75
WindowOverlap: 0
TotalWindows: 14
Mode: 'include'
```

Create a matrix of 4 sequences of integers (1:1000, 1001:2000, 2001:3000, 3001:4000). Segment the data into windows of length 130x4, with 20 samples overlap.

```X = [1:1000; 1001:2000; 2001:3000; 3001:4000]' ;

[WinData, Log] = WindowData(X, WinLen = 130, Overlap = 20)

>>> WinData =
{[1,  1001,  2001,  3001
2,  1002,  2002,  3002
3,  1003,  2003,  3003
...
128,  1128,  2128,  3128
129,  1129,  2129,  3129
130,  1130,  2130,  3130];
[111,  1111,  2111,  3111
112,  1112,  2112,  3112
113,  1113,  2113,  3113
...
238,  1238,  2238,  3238
239,  1239,  2239,  3239
240,  1240,  2240,  3240];
:     :       :     :
:     :       :     :
:     :       :     :
:     :       :     :
[771,  1771,  2771,  3771
772,  1772,  2772,  3772
773,  1773,  2773,  3773
...
898,  1898,  2898,  3898
899,  1899,  2899,  3899
900,  1900,  2900,  3900]}

>>> Log =
struct with fields:
DataType: "multivariate matrix (4 vectors)"
DataLength: 1000
WindowLength: 130
WindowOverlap: 20
TotalWindows: 8
Mode: "exlcude"
```