フィルターのクリア

mean first 10 lines and next 10 line till finish array

2 ビュー (過去 30 日間)
Siti Safwana Abd Razak
Siti Safwana Abd Razak 2021 年 12 月 6 日
コメント済み: Mathieu NOE 2021 年 12 月 7 日
i got 210338x3 table array. how to calculate mean for 10 line, then next 10 line, then next 10 line till finish my table array. i dont know how to group first 10th, next 10 and next 10.
thanks!

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 12 月 6 日
hello
try this
%% dummy data
data = rand(210338,3); % data must be column oriented (number of rows = number of samples)
buffer = 10; % nb of samples for averaging
%% zero overlap averaging (unweighted)
[m,n] = size(data);
for ci=1:fix(m/buffer)
start_index = 1+(ci-1)*buffer;
stop_index = min(start_index+ buffer-1,m);
avg_data(ci,:) =mean(data(start_index:stop_index,:)); % size : 1 x 3
end
  2 件のコメント
Siti Safwana Abd Razak
Siti Safwana Abd Razak 2021 年 12 月 7 日
hi Mathieu,
thanks!
Mathieu NOE
Mathieu NOE 2021 年 12 月 7 日
My pleasure !

サインインしてコメントする。

その他の回答 (1 件)

Chunru
Chunru 2021 年 12 月 6 日
a = rand(210338, 3);
nrows = size(a, 1)
nrows = 210338
n = 10;
nseg = floor(nrows/n)
nseg = 21033
c = squeeze(mean(reshape(a(1:n*nseg,:), n, nseg, 3)));
clast = mean(a((n*nseg+1):end,:)); % last part
whos
Name Size Bytes Class Attributes a 210338x3 5048112 double c 21033x3 504792 double clast 1x3 24 double n 1x1 8 double nrows 1x1 8 double nseg 1x1 8 double

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by