Dear all,
I'm a new matlab user and in my case i have a vector let say: v= [0 0 0 0.1 0.2 0.3 0.4 0.5 0 0 0 0 0 0 0.1 0.2] I want to count consecutive non zero values i.e in my vector have first five nonzero values [0.1 0.2 0.3 0.4 0.5] and two last nozeros values[0.1 0.2] what I want is: count the consecutive non zero values and put a condition i.e if the length of nonzeros is greater then 3 (count>3) then the respective values of vector V(i) remain v(i) if the length consecutive values is less than three (count<3) then respective values of v(i) =0 I want to get a new vector let say v1 derivation from vector v where: v1= [0 0 0 0.1 0.2 0.3 0.4 0.5 0 0 0 0 0 0 0 0]
Any help would be appreciated Thank you DM
Best Answer