Reading a Text file and columns with data
1 view (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Ameer Hamza
on 15 Nov 2020
You can use readmatrix()
M = readmatrix('Data2.txt', 'NumHeaderLines', 3)
2 Comments
More Answers (0)
See Also
Categories
Find more on Spreadsheets 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!