It is something of a challenge to figure out when your first encounter it, but when you think about it and work with it, it’s not all that difficult to understand.
In this example, rows 1 and 4 in ‘subs’ are both (1,1). They correspond to rows 1 and 4 in ‘val’, those being 101 and 104. The function takes those values, adds them, (or ‘accumulates’ them), and puts that value, 205 in the (1,1) position in the output matrix. The ‘subs’ argument does not define the (1,2) position anywhere, so that element remains at 0. The others work the same way.
This isn’t a full explanation, but it should get you started in understanding an extremely useful function.
Best Answer