How to read multiple .txt file in MATLAB ?

4 visualizzazioni (ultimi 30 giorni)
ANKIT KUMAR GOYAL
ANKIT KUMAR GOYAL il 17 Mag 2019
Commentato: madhan ravi il 17 Mag 2019
Hello, I have more than 2000 text files that are having earthquake acceleration value, A single accleration data file is having multiple columns and are having total 14000 acceleration data points, for example a file that is having 14000 acceleration data points is having 2800 data points in each column (total 14000=2800*5), I want to read all the 2000 files in which each file is having 14000 data points and want to get highest value from each file (i.e. highest value form 14000 data points), and want to display 2000 peak acceleration values from 2000 files, as a output form the code.
Note: acceleration values are random which include -ve and +ve values both I want to read absolute maximum value from each file.
Here I am showing two random rows from the text file.
.1562934E-02 .1351712E-02 .1103692E-02 .7845016E-03 .3708470E-03
-.1438702E-03 -.7535660E-03 -.1440769E-02 -.2183040E-02 -.2916107E-02

Risposte (1)

madhan ravi
madhan ravi il 17 Mag 2019
Files = dir('*.txt');
n = numel(Files);
MAX = zeros(n,1);
for k = 1:n
MAX(k) = mean(reshape(load(Files(k).name),[],1));
end

Community Treasure Hunt

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

Start Hunting!

Translated by