How to find min and max of a text file full of numbers?

조회 수: 3 (최근 30일)
NikePro
NikePro 2016년 2월 5일
댓글: Star 2019년 1월 6일
I am trying to figure out how to find a specific value in a text file such as being able to find a min and max by MATLAB reading a .txt and finding the max / min values.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2016년 2월 5일
can you give more details, or explain with an example?
NikePro
NikePro 2016년 2월 5일
Yes, I am trying to find the highest and lowest number in this text file. I am trying to create a code that will read the file and then spit out the highest and lowest numbers.

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

채택된 답변

Star Strider
Star Strider 2016년 2월 5일
This works:
fidi = fopen('Kurtis2821 Text.txt','r');
D = textscan(fidi, '%f%f%f%f%f', 'HeaderLines',1, 'CollectOutput',1);
FileMax = max(D{:}(:))
FileMin = min(D{:}(:))
FileMax =
146.7
FileMin =
-121.08
  댓글 수: 1
Star
Star 2019년 1월 6일
How to find the x intercept of FileMax and FileMin?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by