Azzera filtri
Azzera filtri

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

6 visualizzazioni (ultimi 30 giorni)
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 Commento
Jan
Jan il 26 Giu 2017
Modificato: Jan il 26 Giu 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.

Accedi per commentare.

Risposte (1)

Jess Lovering
Jess Lovering il 26 Giu 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.

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by