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!