필터 지우기
필터 지우기

How can I scan a text file in matlab?

조회 수: 2 (최근 30일)
ben velt
ben velt 2015년 5월 17일
댓글: Walter Roberson 2015년 5월 17일
I want to scan a .txt file with matlab.
I got this grades.txt file:
3033011 Penelope_Cruz Cnm 99 88 77
404402 Gary_Cooper Bio 45 45 45
5055022 Tony_Curtis Dis 23 89 100
606603 Jim_Carrey Mng 100 100 100
7070000 Sandra_Bulloc Cnm 99 45 89
and I want to scan the file with matlab and put it in a structure (like some matrix) so i can pull information from it.
for example, I want to know who is the student with the highest grades.
Actually, I think that the first thing to do is to convert the .txt file into some structure. Any idea on how to do it?

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 17일
tableread()
  댓글 수: 2
ben velt
ben velt 2015년 5월 17일
what do you mean? can you give me an example?
Walter Roberson
Walter Roberson 2015년 5월 17일
T = readtable('grades.txt', 'ReadVariableNames', false);
Grade1 = T.Var4;
Grade2 = T.Var5;
Grade3 = T.Var6;
avgGrade = mean([Grade1, Grade2, Grade3], 2);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by