I'm just not understanding how exactly accumarray works. I checked the official matlab documentation, but I'm still unable to comepletely understand.
If it's something like this, where:
subs = [1
3
4
3
4]
val = 101:105';
accumarray(subs,val) =
[101
0
206
208]
I get that it was A(1)= 101, A(2)= 0, A(3)= 102+104, and A(4)= 103+105
But if it was something like:
subs = [1 1
2 2
3 2
1 1
2 2
4 1]
val = 101:106';
accumarray(subs,val) =
[205 0
0 207
0 203
106 0]
I don't understand how the method works.... I kinda get the A(1) = 101+104, and then that A(2) = 102+105.
But why is that displayed in the second column? Also, why is the [3 2] line not included in the calculation?
I know this is a really simple question, but this is the first time I'm using Matlab.. any help on this would be greatly appreciated, thank you!!