- The index 1 is used onces corresponding to 101. 101 plus nothing else is 101.
- The index 2 is used twice corresponding to 102 and 104, these two numbers are summed.
- There is no occurence of index 3 so it is zero. (See note below)
- The index 4 corresponds to to 103 and 105, the rest is history...
- accumarray uses fillval to fill in elements who have no subs. You can set it using the 5th input to accumarray