column wise adding
13 次查看(过去 30 天)
显示 更早的评论
i had y= 1 6 4 7 5 3 6 4 9 n so on... i want yout=1+6+4 7+5+3 6+4+9
0 个评论
回答(1 个)
Andrei Bobrov
2011-6-8
doc reshape
doc sum
yout = sum(reshape(y,3,[]));
EDIT
z = sum((x-y).^2,2);
2 个评论
David Young
2011-6-8
y(0) = 1 2 5 does not make sense. First because MATLAB array indexes start from 1; second because if y is a numerical array each element must contain a single value, not 3 values. Please can you clarify what you want to do?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!