Reading txt files and getting maximum values with characters and numbers

조회 수: 3(최근 30일)
I am trying to write a function that takes a txt file with names of individuals and their age and income, and with that information find the richest young person and richest old person within the file. I have have approached the problem at difference directions, reading each individual line, making it into a table but I am struggling on even approaching this. Can tips or advice from someone much better at Matlab than me? any help would be appreciated.
  댓글 수: 2
BENJAMIN BUCHDA
BENJAMIN BUCHDA 2021년 2월 23일
Walter, apologizes I meant that I am suppose to find the youngest person in the txt file and within the range of youngest people, who of them makes the most money. Example the youngest age in the file is 21, then out of all the people that are 21, Augusta Gurdian makes the most money. That's what I meant.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 23일
Example:
T = table(randi(4,20,1), randi(99,20,1))
T = 20x2 table
Var1 Var2 ____ ____ 2 34 1 98 3 47 2 78 1 49 1 50 1 38 3 86 3 85 1 6 4 39 4 46 4 17 1 94 2 24 2 72
min1 = min(T{:,1});
T(T{:,1}==min1,:)
ans = 7x2 table
Var1 Var2 ____ ____ 1 98 1 49 1 50 1 38 1 6 1 94 1 76
  댓글 수: 1
BENJAMIN BUCHDA
BENJAMIN BUCHDA 2021년 2월 23일
Thank you so much!!! This was exactly what I was looking for.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

범주

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by