如何在mean
循环中获取向量的for
。向量v
取决于k
。
for k = 1:n
filename = 'file.txt';
...
v = ... %the vector
result = mean(v, 3); %mean along the 3rd dimension.; didn't work.
end
答案 0 :(得分:0)
将result
初始化为单元格数组并继续存储表示。以下应该有效:
result = cell(n,1);
for k = 1:n
filename = 'file.txt';
...
v = ... %the vector
result{k} = mean(v, 3); %mean along the 3rd dimension.; didn't work.
end