How to fix an error from accumarray?

조회 수: 3 (최근 30일)
Pradya Panyainkaew
Pradya Panyainkaew 2018년 2월 7일
댓글: Pradya Panyainkaew 2018년 2월 7일
I have val and subs variables as I shown you and I try to group subs values into same cell array asnd return val to me. When I run this code
A = accumarray(subs,val,[],@(x) {x})
the Matlab software shows this error "Error using accumarray First input SUBS must contain positive integer subscripts.". Thus, I want to know how can I fix it out ?
Thanks in advance

채택된 답변

Walter Roberson
Walter Roberson 2018년 2월 7일
A = accumarray(1+subs,val,[],@(x) {x})

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by