Create a column with maximum values of data

Hello,
I have a problem with a matlab code. I have 10 .txt files. Each file has 2 columns with 10 lines. I' ve created a code which reads my data. But I would like to take only the maximum values of one column of each file. Furthermore, I would like to create a matrix which will include the maximum values of each file one by one.
Could anyone Help me?

2 Comments

So you have ten 10x2 matrices. There are lots of ways to do what you want, but without additional information it is hard to say which would be the best approach. Let's say the matrices are a, b, c, d, e, f, g, h, i, j then depending on what column you want to select to take the maximum (either column 1 or 2) then:
maxArray=[max(a(:,1)),max(b(:,2)),max(c(:,1)),max(d(:,1)),max(e(:,1)),max(f(:,2)),max(g(:,1)),max(h(:,1)),max(i(:,1)),max(j(:,2))];
Please attach two sample txt files, so that we can respond you with details.

Answers (0)

This question is closed.

Asked:

on 1 Oct 2019

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!