Find the minimum value from many files

6 visualizaciones (últimos 30 días)
Ivan Mich
Ivan Mich el 24 de Nov. de 2020
Respondida: TESFALEM ALDADA el 24 de Nov. de 2020
Hello,
I would like to create a code which will read multiple files and find the minumum value from each file. I have multiple .txt files. Every .txt files has 2 columns. I would like my code :
1) Read 2nd column of all .txt files and find the minimum value of each .txt file
2) to export each minimum value from each .txt file to one output
I think I should use a loop but I am confused about syntax.
Could you help me?

Respuestas (1)

TESFALEM ALDADA
TESFALEM ALDADA el 24 de Nov. de 2020
You can also put individual text file contents in a cell array, to help easy operation so that,
e.g d=cell(1,length(file))
% minimum of second column
min_d=nan(1,length(d)); %vector initialization
for i=1:lenght(d)
min_d(1,i)=min(d{:,i}(:,2));
end

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by