MATLAB Answers

Create a column with maximum values of data

2 views (last 30 days)
Ivan Michael
Ivan Michael on 1 Oct 2019
Commented: KALYAN ACHARJYA on 1 Oct 2019
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

David Hill
David Hill on 1 Oct 2019
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))];
KALYAN ACHARJYA
KALYAN ACHARJYA on 1 Oct 2019
Please attach two sample txt files, so that we can respond you with details.

Sign in to comment.

Answers (0)

Sign in to answer this question.