[Tutor] Extract several arrays from a large 2D array

Ek Esawi esawiek at gmail.com
Wed Jan 20 23:22:14 EST 2016


Hi All--



I have a 2D array (2000, 4); an example is given abelow.  On the 1st column
I have 15 variables, on the 2nd 4 variables. Ignore column 3 for now. I
want a code that generate 4 arrays for each variable on the 1st column;
each array contains all the values from column 4. Then I want to find the
average of each array.



For example; pick the 1st variable in column 1 which is 1; then pick the 1st
variable on the 2nd column which is 5. Now I want an array that contains
all the values on the 4th column that match variable 1 on the 1st and
variable 5 on the 2nd column. I need to get the average of each array.





A             b             c              d

1              5              3              4

1              3              2              7

2              5              7              5

3              2              8              5

2              3              2              3


Thanks in advance—EKE


More information about the Tutor mailing list