Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

subvector without zeros

$
0
0
How can I obtain vectors whenever find a zero or zeros, for example this is the input

a=[16 17 32 0 0 63 79 80 0 0 0 113 0 129 130]

 and I want to obtain vectors and their sum

a1={6 17 32 }= sum{a1}
a2={63 79 80}= sum{a2}
a3={113 }= sum{a3}
a4={129 130}= sum{a4}

thanks

Viewing all articles
Browse latest Browse all 19628

Latest Images

Trending Articles



Latest Images