06-20-2012 02:06 PM
Hi,
How to split 1D array to 2D array, depending on the number specified.
e.g I want to group 2 data at a time.
1D array: 300 200 98 77 66 662 53 120 to
2D array: 300 200
98 77
66 662
53 120
Thanks!!!
06-20-2012 02:11 PM - edited 06-20-2012 02:12 PM
You can use the "decimate 1D array" primitive (this will split your 1D array into 2 1D arrays) followed by a build array to "join" your two 1D arrays into a 2D array.
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
06-20-2012 02:14 PM
Hi Titou,
what if I want more than 2 e.g 30?
06-20-2012 02:20 PM - edited 06-20-2012 02:21 PM
A 30 dimensions array?? Do you have a use case for that??
The decimate primitive is expandable so is the build array so you can do more than 2, but 30... sounds extreme.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
06-20-2012 02:24 PM
I mean I got a 1D array with 900 data and want to group by 30.
That means every 30 data I want to turn it into a 1d array after that using all the 1d array I want to build a 2D array. How should I do that?
06-20-2012 02:25 PM
side note : apparently there are some users out there who use a higher than usual number of dimensions
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
06-20-2012 02:31 PM
@Nextal wrote:
I mean I got a 1D array with 900 data and want to group by 30.
That means every 30 data I want to turn it into a 1d array after that using all the 1d array I want to build a 2D array. How should I do that?
Oh, sorry... to do that you have to use a different technique. The "reshape array" is your friend, you candrag it down to add dimensions to the output array (2 in your case) and set the dimensions' size (30 and 30 in the case you mention).
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
06-20-2012 02:32 PM
Hi Titou,
I am sorry for being not clear.
I have a 1D array with 900 row.
Every 30 row I want to create a 1D array.
So at the end I will have 30 1D array next I want to get a 2D array using this 30 1D array. How should I implement this?
06-20-2012 02:34 PM
Sorry I didn't see you reply and post again I will try the reshape functions.
06-20-2012 02:38 PM
Thanks, this is what I want. 🙂