Detect maximum value of multiple Excel-Files

1 回表示 (過去 30 日間)
Talha Demirel
Talha Demirel 2019 年 8 月 6 日
回答済み: Bob Thompson 2019 年 8 月 6 日
Hi,
is it possible to scan e.g. 100 excel files and detetct the maximum values of each?
in one file there are many distance values registered, so the goal is to extract the maximum distance per file.
--> file_1,max: 3 cm
file_2,max: 5 cm
file_3,max: 7 cm
.
.
.
file_100,max: 4 cm
And then I want to create a diagram out of these maximum datas which is not a big issue. The main task is to generate the maximum values of the files.
Thanks.

回答 (1 件)

Bob Thompson
Bob Thompson 2019 年 8 月 6 日
The cleanest way that I can think of doing this is to just loop things. You may need to change the range you are looking to find the maximum value in, but the basic concept should be the same as this:
files = dir('*.xlsx'); % Assumes you are working in the folder with the excel documents, and they are all in one folder already
for i = 1:length(files)
data = xlsread(files(i).name,range); % If no range is specified, will read the entire first sheet
maxes(i) = max(data); % Maximum value in entire dataset
end

カテゴリ

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