How can i creat subvectors ?

3 次查看(过去 30 天)
benghenia aek
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?

请先登录,再进行评论。

回答(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

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
>>

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by