Effacer les filtres
Effacer les filtres

How can i creat subvectors ?

3 vues (au cours des 30 derniers jours)
benghenia aek
benghenia aek le 22 Jan 2019
Modifié(e) : benghenia aek le 22 Jan 2019
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 commentaires
Stephen23
Stephen23 le 22 Jan 2019
Modifié(e) : Stephen23 le 22 Jan 2019
What is
help hElp ..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​...............................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​........................................​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​..........​.................................. supposed to mean?
Kevin Phung
Kevin Phung le 22 Jan 2019
L O L

Connectez-vous pour commenter.

Réponses (2)

Jan
Jan le 22 Jan 2019
Modifié(e) : Jan le 22 Jan 2019
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 commentaire
benghenia aek
benghenia aek le 22 Jan 2019
thak you very much sir :)

Connectez-vous pour commenter.


madhan ravi
madhan ravi le 22 Jan 2019
Modifié(e) : madhan ravi le 22 Jan 2019
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 commentaire
benghenia aek
benghenia aek le 22 Jan 2019
thank you very much :)

Connectez-vous pour commenter.

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by