필터 지우기
필터 지우기

How can i creat subvectors ?

조회 수: 4 (최근 30일)
benghenia aek
benghenia aek 2019년 1월 22일
편집: benghenia aek 2019년 1월 22일
I have vector a=[1 2 5 NAN NAN 9 0 23 12.....NAN.......6 2 8]
how to creat subvector
a(1)=[1 2 5] and index index(1)=[1 2 3]
a(2)=[9 0 23 12] and index index(2)=[6 7 8 9]
.
a(n)=[6 2 8] and index index(n)=[101 102 103]
  댓글 수: 3
Stephen23
Stephen23 2019년 1월 22일
편집: Stephen23 2019년 1월 22일
What is
help hElp ..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​...............................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................. supposed to mean?
Kevin Phung
Kevin Phung 2019년 1월 22일
L O L

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2019년 1월 22일
편집: Jan 2019년 1월 22일
a = [1 2 5 NaN NaN 9 0 23 12 NaN 6 2 8];
[B, N, Ind] = RunLength(isnan(a));
match = (~B);
N = N(match);
Ind = Ind(match); % [EDITED, Inf -> Ind]
num = numel(Ind);
Result = cell(1, num);
Index = cell(1, num);
for k = 1:num
Index{k} = Ind(k):Ind(k)+N(k)-1;
Result{k} = a(Index{k});
end
If you do not have a C-compiler installed, use RunLength_M from the same submission.
Alternative:
m = [true, isnan(a), true];
ini = strfind(m, [true, false]);
fin = strfind(m, [false, true]);
n = numel(ini)
Result = cell(1, n);
Index = cell(1, n);
for k = 1:n
Index{k} = ini(k)+1:fin(k);
Result{k} = a(ini(k)+1:fin(k));
end
  댓글 수: 1
benghenia aek
benghenia aek 2019년 1월 22일
thak you very much sir :)

댓글을 달려면 로그인하십시오.


madhan ravi
madhan ravi 2019년 1월 22일
편집: madhan ravi 2019년 1월 22일
a=[1 2 5 NaN NaN 9 0 23 12 NaN 6 2 8]
index=find(~isnan(a));
idx=find([diff(index)~=1 0]);
Final=mat2cell(a(~isnan(a)),1,[idx(1) diff(idx) numel(index)-idx(end)]);
Index=mat2cell(index,1,[idx(1) diff(idx) numel(index)-idx(end)]);
Gives:
>> celldisp(Final)
Final{1} =
1 2 5
Final{2} =
9 0 23 12
Final{3} =
6 2 8
>> celldisp(Index)
Index{1} =
1 2 3
Index{2} =
6 7 8 9
Index{3} =
11 12 13
>>
  댓글 수: 1
benghenia aek
benghenia aek 2019년 1월 22일
thank you very much :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by