Thanks, and hope you be patent with my questions:
I tried the below and got 2 different answers:
split_seq(sequence, n) = [sequence[offset+column] for offset in 0:n-1, column in 1:length(sequence)-n+1]
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
x = split_seq(a, 3)
@show x
Answer:
x = ([1 2 3; 2 3 4; 3 4 5; 4 5 6; 5 6 7; 6 7 8; 7 8 9], [4, 5, 6, 7, 8, 9, 10])
Other way, without creating a function:
sequence = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
z = [sequence[offset+column] for offset in 0:3-1, column in 1:length(sequence)-3+1]
@show z
Answer:
z = [1 2 3 4 5 6 7 8; 2 3 4 5 6 7 8 9; 3 4 5 6 7 8 9 10]