필터 지우기
필터 지우기

Reading a Text file and columns with data

조회 수: 2 (최근 30일)
Am Gill
Am Gill 2020년 11월 15일
댓글: Ameer Hamza 2020년 11월 15일
Hi, I am trying to read a text file that is attached to this question. It looks something like this:
Number of Days
Day 1 Temperature
250 1003
300 1005
350 1008
400 1013
450 1020
500 1029
550 1040
600 1051
650 1063
700 1075
750 1087
800 1099
900 1121
1000 1142
1100 1155
1200 1173
1300 1190
1400 1204
1500 1216
I am just trying to read the numerical data. That is to say that I am trying to read this text file without the 'number of days', without the space between 'the number of days' and the column headings and neither the column headings themselves (day 1 and temperature).
I would also like to read and save the Data in 2 columns (just like it is shows): one for Days and one for Temperature.
Please help! I used the fscanf function and import data but they did not work!
Please help!

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 15일
You can use readmatrix()
M = readmatrix('Data2.txt', 'NumHeaderLines', 3)
  댓글 수: 2
Am Gill
Am Gill 2020년 11월 15일
Thank you so much! It worked perfectly!
Ameer Hamza
Ameer Hamza 2020년 11월 15일
I am glad to be of help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by