MATLAB Function Reference |
Syntax
B = sum(A)
B = sum(A,
dim)
Description
若 A
是多維陣列,sum(A)
會從第一個非單一維度(the first nonsingleton dimension)開始進行每一維度的總和運算。
B = sum(A,dim)
根據所給定的維度 dim
來進行總和運算。
Remarks
Examples
M = magic(3) M = 8 1 6 3 5 7 4 9 2
sum(M) = 15 15 15
sum(M') = 15 15 15
See Also
subvolume | superiorto |