複数データの平均値をfor文にてセルに格納する方法を教えてください
Show older comments
入れ子構造になっているcellデータの行平均データを作成したいと思い、以下のコードを実行しましたが、確認すると明らかに違うデータが格納されてしまいます。
for i = 1:9 % cellデータの変数名(オイラー角X,Y,Z、加速度X,Y,Z、ジャイロX,Y,Zの計9列)
th = sub.Thorax;
for j = 1:numel(th) % 1×26cell(1×1cellの中にはさらに100×9doubleのデータが格納されている)
th_(:,j) = th{j}(:,i); % 各列の周期分を一度th_に格納; th_は100×26doubleのデータ
end
th_mean(:,i) = mean(th{j}(:,i), 2) ; % th_の行平均をth_meanに格納。それを周期分(1:numel(sub.Thorax))繰り返して100×9 doubleのデータを作成したい
end
for文の中でfor文を繰り返す必要があると思うのですが書き方がわかりません。ご教授いただけましたらさいわいです。
1 Comment
Kohei Yoshino
on 3 May 2024
Accepted Answer
More Answers (0)
Categories
Find more on Downloads in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!