Detect maximum value of multiple Excel-Files

1 Ansicht (letzte 30 Tage)
Talha Demirel
Talha Demirel am 6 Aug. 2019
Beantwortet: Bob Thompson am 6 Aug. 2019
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.

Antworten (1)

Bob Thompson
Bob Thompson am 6 Aug. 2019
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

Community Treasure Hunt

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

Start Hunting!

Translated by