Borrar filtros
Borrar filtros

how to read numbers in txt file (numbers with space and colons)

6 visualizaciones (últimos 30 días)
Ben
Ben el 26 de Jun. de 2017
Editada: per isakson el 26 de Jun. de 2017
Hi:
I have a text file that has following format of the numbers
A1 B11:C11 B12:C12 B13:C13... (carrier return)
A2 B21:C21 B22:C22 B23:C23... (carrier return)
A3 B31:C31 B32:C32 B33:C33... (carrier return)
.....
A is interger (1-6 digits). B is xxx.xx or xx.xx. C is 1 to 5digits of interger. The goal is to read all of lines (it has different number of columns) and put them into a matrix. How to read all of the numbers here delimited with spaces and columns? Many thanks.
  1 comentario
Jan
Jan el 26 de Jun. de 2017
Editada: Jan el 26 de Jun. de 2017
I've used the "{} Code" button to format the contents of the file. Did you see, that the auto-linebreaks of the forum made it unreadable? I cannot understand, why so many user do not care, if their question is not readable. Isn't it the vital interest of a question to be as easy to understand as possible?
What does " B is xxx.xx or xx.xx" mean? Does "C11" and "C is 1 to 5digits of integer" mean e.g. "1234511"? What exactly does "..." stand for?
Please post a small example of the real data.

Iniciar sesión para comentar.

Respuestas (1)

Jess Lovering
Jess Lovering el 26 de Jun. de 2017
You can try to use the import GUI (button on toolbar) to import the data and also generate a script that you can use as an example and use in the future. It's pretty simple to use. For instruction type "doc import tool" at the prompt.

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by