Hello
The wording is a bit bad in the title and I struggle to explain what I want to do properly, but basically what I want to do is;
Suppose I have an array I consisting of indices:
I = [1 1 1 2 2 2 3 3 3]
And an array of results, R:
R = [2 4 7 8 5 1 9 8 1]
Then I want to produce a sum of R based on the indices of I, such that a final result would be:
FR = [13 14 18]
Where 13 comes from the first 3 indices being 1 1 1 in I.
Hope someone got what I mean…
EDIT: And I want to do it using a broadcasting operation, no for loops
Kind regards