>> A = randi(10,1e4,5);
>> timeit(@() accumarrayStable(A(:,1:end-1),A(:,end), [], @(x) x(end)))
ans =
0.0662
>> timeit(@() accumarrayStable2(A(:,1:end-1),A(:,end), [], @(x) x(end)))
ans =
0.0600
Pj4gQSA9IHJhbmRpKDEwLDFlNCw1KTsKPj4gdGltZWl0KEAoKSBhY2N1bWFycmF5U3RhYmxlKEEoOiwxOmVuZC0xKSxBKDosZW5kKSwgW10sIEAoeCkgeChlbmQpKSkKYW5zID0KICAgIDAuMDY2Mgo+PiB0aW1laXQoQCgpIGFjY3VtYXJyYXlTdGFibGUyKEEoOiwxOmVuZC0xKSxBKDosZW5kKSwgW10sIEAoeCkgeChlbmQpKSkKYW5zID0KICAgIDAuMDYwMA==