Importing data from a complex text file
Show older comments
Greetings
I'm fairly inexperienced in MATLAB and I've got a rather difficult problem on my hands. I need to import a set of numbers from a text file. The sample of a text file is on the link: https://www.dropbox.com/s/oexzfcdrfyj8n2n/FSB32E15M-L20.txt?dl=0
As you can see, numbers are arranged in groups. Each group consists of 512 pairs of numbers closed in brackets. I need to import these numbers into MATLAB in a following way: Each group of numbers will make two vectors, for example, X1 and Y1. The first number in bracket will go into the X1 vector, and the second number in bracket will go into the Y1 vector. For example, if the text file says: (2029,0),(2034,0),(1998,0)... my vectors will be:
X1 = [2029 2034 1998 ....]
Y1 = [0 0 0 ....]
And since the file has 25 groups of numbers, I should end up with 50 vectors. X1-X25 and Y1-Y25. Every other text in the file is to be ignored.
Any suggestions on how to do this will be appreciated :)
Btw., not everything needs to be automated or 100% efficient. I can do some manual work if it means having a much simpler code.
2 Comments
Guillaume
on 5 Jun 2015
You can dismiss the prompt(s) to sign in into dropbox and access the file nonetheless. I agree, attaching it here makes it more accessible.
Accepted Answer
More Answers (0)
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!