i have multiple array, number can arbitrary. size of array same. how add each element of respective element of arrays , maybe save in array
a1 = [1 2 3 4 5 6] a2 = [1 2 3 4 5 6] . . . . final = [1+1+1+... 2+2+2+.... 3+3+3+3.... 4+4+4.... 5+5+5+5... 6+6+6+6...]
let's have structure (as write in comments):
main = struct('err',{1:6,5:10,1:6,1:6},'seg_err',{1:6,5:10,1:6,5:10});
you can convert matrix:
m = vertcat(main.seg_err);;
and take sum in simple command:
final = sum(m)
which results:
final = 12 16 20 24 28 32
and @beaker :)
Comments
Post a Comment