how to read numbers in txt file (numbers with space and colons)
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2017-6-26
编辑:Jan
2017-6-26
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.
回答(1 个)
Jess Lovering
2017-6-26
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!