필터 지우기
필터 지우기

Group array elements based upon their differences

조회 수: 1 (최근 30일)
tusu
tusu 2014년 9월 6일
댓글: joy 2014년 9월 6일
I have an array
x=[20 18 16 14 11 9 6 3 2 1]
I can find the intermediate difference of the array elements by
x1=-diff(x)
x1=[2 2 2 3 2 3 3 1 1]
Now based upon x1 value, I can group/partition,
x (that array)
in 4 parts where there is a variation of their mutual differences
such that
c1={20,18,16,14}
c2={11}
c3={9,6}
c4={3,2,1}
what shall be my programming logic so that I could partition it 3 or 5 groups as well.
thanks

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by