How can i creat subvectors ?

1 回表示 (過去 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 Center および File ExchangeString Parsing についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by