Calculating Mean, Median, STD from an excel documents that has 68 sheets and in each sheet there are 20 columns

4 ビュー (過去 30 日間)
I have a code that reads the excel document. and created a matrix with 68 tables each one represents one of my sheets.
I need to calculate the average from all the rows in coloumn 13:16 in each of these sheets.
%My Code for reading the excel document.
[status,sheets,xlFormat]=xlsfinfo('Majorfaults_300m_10profiles.xlsx')
for k=1:numel(sheets)
data{k}=xlsread('Majorfaults_300m_10profiles.xlsx',sheets{k});
end
...........................................................................................
%%The following is what I have so far to calculate the values but it is not returning right values and only 24 values rather than 68
for k=1:68 %68 tables (sheets from my excel document)
for n = 1:4 % 4 coloums in each sheet where the values need to be calculated
for i = 13:16 %the coloums in the excel sheet the values are calculated from
minimum(n)= min( data{k}(3:end,i));
maximum(n)= max( data{k}(3:end,i));
average(n)= mean( data{k}(3:end,i));
medi(n)= median( data{k}(3:end,i));
end
end
end

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 12 月 2 日
編集済み: Mathieu NOE 2021 年 12 月 2 日
hello Sophie
you can do everything within the first for loop
I assumed that the min/max / med / average computation muts give 4 values per sheet as you want these results per column
results are stored as cell arrays - other options are also doable
%My Code for reading the excel document.
[status,sheets,xlFormat]=xlsfinfo('Majorfaults_300m_10profiles.xlsx');
for k=1:numel(sheets)
data=xlsread('Majorfaults_300m_10profiles.xlsx',sheets{k});
data_extract = data(3:end,13:16); %the colums in the excel sheet the values are calculated from
minimum{k}= min(data_extract,[],1);
maximum{k}= max(data_extract,[],1);
average{k}= mean(data_extract,1);
medi{k}= median(data_extract,1);
end
  7 件のコメント
Sophie Freunek
Sophie Freunek 2021 年 12 月 3 日
Great! thank you so much for your help and time :D

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

その他の回答 (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