I’ve a series of 60 elements:
series = [30,21,29,31,40,48,53,47,37,39,31,29,17,9,20,24,27,35,41,38,
27,31,27,26,21,13,21,18,33,35,40,36,22,24,21,20,17,14,17,19,
26,29,40,31,20,24,18,26,17,9,17,21,28,32,46,33,23,28,22,27,
18,8,17,21,31,34,44,38,31,30,26,32];
I want to convert it to an array of 6 elements, where each element is an array of 12 elements
I tried reshape:
zx = reshape(series, 12, :)
That generates another array of elements as:
12×6 Array{Int64,2}:
30 17 21 17 17 18
21 9 13 14 9 8
29 20 21 17 17 17
31 24 18 19 21 21
40 27 33 26 28 31
48 35 35 29 32 34
53 41 40 40 46 44
47 38 36 31 33 38
37 27 22 20 23 31
39 31 24 24 28 30
31 27 21 18 22 26
29 26 20 26 27 32
But this does not looks to be what I want, I need to have it as:
12-element Array{Array{Int64,1},1}:
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
[1 2 … 11 12]
In some functional programming languages, this is called chunk
, so I need to have my series converted to chunks of 12 elements each