Error with accumarray code
Show older comments
So I have matlab code to find maximum wave height (Hs) with 2 condition: by direction and by year like this photos below.

TableHm2 = readtable('02_Output HsTs.xlsx');
[r,rn] = findgroups(TableHm2(:,1));
[c,cn] = findgroups(TableHm2(:,6));
out = accumarray([r,c],TableHm2.Hs,[],@max);
Tout = array2table([rn.Tahun,out],'VariableNames',[{'Year'};cn.Arah2]);
But when I was running, it didnt work. The error says:
Error using accumarray
First input SUBS must contain positive integer subscripts.
Error in coba3 (line 4)
out = accumarray([r,c],TableHm2.Hs,[],@max);
So, how should I do? Thanks before
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!