Borrar filtros
Borrar filtros

Reading a Text file and columns with data

2 visualizaciones (últimos 30 días)
Am Gill
Am Gill el 15 de Nov. de 2020
Comentada: Ameer Hamza el 15 de Nov. de 2020
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!

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 15 de Nov. de 2020
You can use readmatrix()
M = readmatrix('Data2.txt', 'NumHeaderLines', 3)
  2 comentarios
Am Gill
Am Gill el 15 de Nov. de 2020
Thank you so much! It worked perfectly!
Ameer Hamza
Ameer Hamza el 15 de Nov. de 2020
I am glad to be of help!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by