Error with accumarray code
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!