Info

此问题已关闭。 请重新打开它进行编辑或回答。

mean(x) function not actually taking the mean

1 次查看(过去 30 天)
So I have a code to find the average values (Avg.CAR.Block(i)) of EMG data across 22536 frames/data points. After I run the code, the mean should just give me one single number representing the average of all frames, but Avg.CAR.Block(i) still returns the exact same value as CAR.Block(i).
for i=1:3
for j=1:length(Norm.Block(i).Rlong)
%R:L Longissimus
if Norm.Block(i).Rlong(j) <= Norm.Block(i).Llong(j)
CAR.Block(i).RLlong(j)=Norm.Block(i).Rlong(j)/Norm.Block(i).Llong(j);
else Norm.Block(i).Rlong(j)>Norm.Block(i).Llong(j);
CAR.Block(i).RLlong(j)=Norm.Block(i).Llong(j)/Norm.Block(i).Rlong(j);
end
%Average across block trials
for i=1:3
for j=1:length(Norm.Block(i).Rlong)
AvgCAR.Block(i).RLlong(j)=mean(CAR.Block(i).RLlong(j));
AvgCAR.Block(i).RLrectus(j)=mean(CAR.Block(i).RLrectus(j));
AvgCAR.Block(i).RLrectus(j)=mean(CAR.Block(i).RLgmed(j));
AvgCAR.Block(i).RLeo(j)=mean(CAR.Block(i).RLeo(j));
end
end
These are the values of Avg.CAR.Block(i) and the CAR.Block(i) values are the exact same
Why isn't the mean function working?
  1 个评论
John D'Errico
John D'Errico 2020-6-3
Is this:
CAR.Block(i).RLlong(j)
a scalar value? If so, then why do you expect mean to somehow remember the previous times it has been called? After all, if I compute mean(3), what value should it produce? If I then call mean(5), should mean do something other than return the value 5?

回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by