请注意,下面的代码是从 Matlab 文档中获得的,底部除外。
function B = nway(A,n)
% Compute average of every N elements of A and put them in B.
if ((mod(numel(A),n) == 0) && (n>=1 && n<=numel(A)))
B = ones(1,numel(A)/n);
k = 1;
for i = 1 : numel(A)/n
B(i) = mean(A(k + (0:n-1)));
k = k + n;
end
for 循环代码是什么意思,尤其是下面一行?
for i = 1 : numel(A)/n
以及如何i
将其插入其中B(i)
?