I have an array like this [2 2 3 4 0 0 0 0 7 8 2 2]. Please i want to add the numbers excluding the zeros to have something like this[11 0 0 0 0 19] Please is there a way I can do it. Thanks
MATLAB: Sum Numbers Excluding Zeros
sum
Related Question
- Perform function on each vector within an array
- Counting zeros in array
- How to extract the first non-zero in several specific segments of the same matrix
- I have large matrix and i want to find the number of consecutive zeros if there is more than 10 disply(hole) and give the index of the start and end of this vector of zeros,
- I am getting the error “Subscript indices must either be real positive integers or logicals.” just want to know what is the cause of this error.. how to resolve it I have already checked another ans for the same error but could’t able to remove err
- Matrix Indices Problem
Best Answer