Filter löschen
Filter löschen

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

6 Ansichten (letzte 30 Tage)
Ben
Ben am 26 Jun. 2017
Bearbeitet: per isakson am 26 Jun. 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 Kommentar
Jan
Jan am 26 Jun. 2017
Bearbeitet: Jan am 26 Jun. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jess Lovering
Jess Lovering am 26 Jun. 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.

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by