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

obtain independent vectors of non zeros

$
0
0
How can I obtain cell array whenever I find a zero or zeros, for example:

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

I want to obtain subsets of non zeros and their sum

a1={16 17 32 } and their sum1= sum(a1)

a2={63 79 80} and their sum2= sum(a2)

a3={113} and their sum3= sum(a3)


a4={129 130 } and their sum4= sum(a4)

Viewing all articles
Browse latest Browse all 19628

Latest Images

Trending Articles



Latest Images