lets say I had A=[1 0 1 1 0 1 0 1 0 0 1 1 1 1]; then I want B(1)=sum of all A elements, B(2)= sum all elements of A from A(2) excluding a(1), similarly for B(3) = sum of all A elements with excluding A(1),A(2) and so on…then B should be B=[9 8 8 7 7 6 5 5 4 4 4 3 2 1] thanks
MATLAB: Sum of array elements with specific condition
sum
Related Question
- EASY Question: How to find an element of a matrix
- Find the pair of the matrix
- Is it possible to extract the values with a vector of indices for each row without using the for statement from the matrix
- How to swapping values in matrix row
- How to modify a matrix to change the entries >=0 and multiply it by 5 AND to change the entries <0 and add 2 to those entries
Best Answer