calculating the average from a large excel file

1 回表示 (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2017 年 1 月 30 日
Hi again,
I have a really large excel file which I have imported in Matlab.
So it's a large array with dimensions : 588845x10 double
how can I get the average value from the first 48 values, then the average from the the next 48 values and so on?
many thanks,
Nikolas

採用された回答

Guillaume
Guillaume 2017 年 1 月 30 日
編集済み: Guillaume 2017 年 1 月 30 日
>>588845/48
ans =
12267.604
The number of rows is not divisible by 48. What are you planning to do with the last few rows?
Assuming you have a number of rows divisible by 48, the easiest is to reshape the matrix into 48 rows, and take the mean along the rows.
m = reshape(1:5888450, 588845, 10); %demo data, replace by your own matrix
croppedm = m(1 : size(m,1)-mod(size(m, 1), 48), :); %crop number of rows to multiple of 48
meancroppedm = squeeze(mean(reshape(croppedm, 48, [], size(m, 2)), 1)) %mean along rows
The mean of the last portion:
meancutm = mean(m(size(m, 1)-mod(size(m, 1),48) : end, :), 1)
The two combined
mean48 = [meancroppedm; meancutm]
  1 件のコメント
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2017 年 1 月 30 日
it works!! thanks a lot!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by