I'm trying to sum every two row and store the answer in new matrix, but the code keep giving me the wrong sum and copy the wrong answer in all the row of the new matrix.
조회 수: 2(최근 30일)
s=zeros(floor(N/2),1); %allocate array for the sums of 2 elements at a time
Try the above.
The approach above is nicer than my first answer, because it does not use a for loop. It works when Agg_load_1 has an even number of elements. It would need an adjustment if Agg_load_1 has an odd number of elements.